-2

Team,

I need to provision an Azure VM (Windows/Linux) and I followed the below link to create the image first.

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/build-image-with-packer

https://docs.microsoft.com/en-us/azure/virtual-machines/linux/build-image-with-packer

Now, I have to provision the Virtual Servers from these images using Terraform.

I am able to find the steps to create using a VHD with Terraform but not the managed image.

Can anyone help me or direct me in the correct direction to provision an VM using terraform from Packer built managed images.

Thanks in advance.

1 Answers1

2

Use the azurerm_image resource and storage_image_reference:

resource "azurerm_image" "test" {
  name = "myPackerImage"
  location = "East US"
  resource_group_name = "myPackerGroup"
  os_disk {
     os_type ="Windows"
     os_state = "Generalized"
     caching = "ReadWrite"
  }
}

storage_image_reference {
   id = "${azurerm_image.test.id}"
}
djpm
  • 131
  • 4