Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- resource "azurerm_managed_disk" "managedDisk" {
- name = "managed_disk_test"
- location = "northeurope"
- resource_group_name = "${azurerm_resource_group.packer.name}"
- storage_account_type = "Standard_LRS"
- create_option = "FromImage"
- # image_reference_id = NOT SURE IF I NEED THIS
- disk_size_gb = "1"
- }
- resource "azurerm_virtual_machine" "PackerVm_TEST" {
- name = "${var.hostname}"
- location = "northeurope"
- resource_group_name = "${azurerm_resource_group.packer.name}"
- network_interface_ids = ["${azurerm_network_interface.packerNetInt_Test.id}"]
- vm_size = "Standard_D2s_v3"
- storage_os_disk {
- name = "FromPackerImageOsDisk"
- image_uri = "${var.image_uri}"
- vhd_uri = "https://${var.storage_account_name}.blob.core.windows.net/vhds/${var.hostname}-osdisk.vhd"
- os_type = "${var.os_type}"
- caching = "ReadWrite"
- create_option = "FromImage"
- }
- # made based on planned TF changes from running plan command
- os_profile {
- computer_name = "PackerVmTEST"
- admin_username = "USER"
- admin_password = "Test123"
- }
- os_profile_windows_config {
- enable_automatic_upgrades = "true"
- provision_vm_agent ="true"
- }
- }
- {
- "builders": [{
- "type": "azure-arm",
- "client_id": "",
- "client_secret": "",
- "tenant_id": "",
- "subscription_id": "",
- "object_id": "",
- "managed_image_resource_group_name": "packerRG",
- "managed_image_name": "myPackerImage",
- "os_type": "Windows",
- "image_publisher": "MicrosoftWindowsServer",
- "image_offer": "WindowsServer",
- "image_sku": "2016-Datacenter",
- "communicator": "winrm",
- "winrm_use_ssl": "true",
- "winrm_insecure": "true",
- "winrm_timeout": "3m",
- "winrm_username": "packer",
- "azure_tags": {
- "dept": "Engineering",
- "task": "Image deployment"
- },
- "location": "northeurope",
- "vm_size": "Standard_DS2_v2"
- }],
- "provisioners": [{
- "type": "powershell",
- "inline": [
- "Add-WindowsFeature Web-Server",
- "if( Test-Path $Env:SystemRoot\windows\system32\Sysprep\unattend.xml ){ rm $Env:SystemRoot\windows\system32\Sysprep\unattend.xml -Force}",
- "& $Env:SystemRoot\System32\Sysprep\Sysprep.exe /oobe /generalize /shutdown /quiet"
- ]
- }]
- }
Add Comment
Please, Sign In to add comment