Guest User

Untitled

a guest
Jan 3rd, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. resource "azurerm_managed_disk" "managedDisk" {
  2. name = "managed_disk_test"
  3. location = "northeurope"
  4. resource_group_name = "${azurerm_resource_group.packer.name}"
  5. storage_account_type = "Standard_LRS"
  6. create_option = "FromImage"
  7. # image_reference_id = NOT SURE IF I NEED THIS
  8. disk_size_gb = "1"
  9. }
  10.  
  11.  
  12. resource "azurerm_virtual_machine" "PackerVm_TEST" {
  13. name = "${var.hostname}"
  14. location = "northeurope"
  15. resource_group_name = "${azurerm_resource_group.packer.name}"
  16. network_interface_ids = ["${azurerm_network_interface.packerNetInt_Test.id}"]
  17. vm_size = "Standard_D2s_v3"
  18.  
  19.  
  20. storage_os_disk {
  21. name = "FromPackerImageOsDisk"
  22. image_uri = "${var.image_uri}"
  23. vhd_uri = "https://${var.storage_account_name}.blob.core.windows.net/vhds/${var.hostname}-osdisk.vhd"
  24. os_type = "${var.os_type}"
  25. caching = "ReadWrite"
  26. create_option = "FromImage"
  27. }
  28.  
  29. # made based on planned TF changes from running plan command
  30. os_profile {
  31. computer_name = "PackerVmTEST"
  32. admin_username = "USER"
  33. admin_password = "Test123"
  34. }
  35. os_profile_windows_config {
  36. enable_automatic_upgrades = "true"
  37. provision_vm_agent ="true"
  38. }
  39.  
  40. }
  41.  
  42. {
  43. "builders": [{
  44. "type": "azure-arm",
  45.  
  46. "client_id": "",
  47. "client_secret": "",
  48. "tenant_id": "",
  49. "subscription_id": "",
  50. "object_id": "",
  51.  
  52. "managed_image_resource_group_name": "packerRG",
  53. "managed_image_name": "myPackerImage",
  54.  
  55. "os_type": "Windows",
  56. "image_publisher": "MicrosoftWindowsServer",
  57. "image_offer": "WindowsServer",
  58. "image_sku": "2016-Datacenter",
  59.  
  60. "communicator": "winrm",
  61. "winrm_use_ssl": "true",
  62. "winrm_insecure": "true",
  63. "winrm_timeout": "3m",
  64. "winrm_username": "packer",
  65.  
  66. "azure_tags": {
  67. "dept": "Engineering",
  68. "task": "Image deployment"
  69. },
  70.  
  71. "location": "northeurope",
  72. "vm_size": "Standard_DS2_v2"
  73. }],
  74. "provisioners": [{
  75. "type": "powershell",
  76. "inline": [
  77. "Add-WindowsFeature Web-Server",
  78. "if( Test-Path $Env:SystemRoot\windows\system32\Sysprep\unattend.xml ){ rm $Env:SystemRoot\windows\system32\Sysprep\unattend.xml -Force}",
  79. "& $Env:SystemRoot\System32\Sysprep\Sysprep.exe /oobe /generalize /shutdown /quiet"
  80. ]
  81. }]
  82. }
Add Comment
Please, Sign In to add comment