We have created custom OS image -- managed disk and need to spun a VM using terraform script to use the custom created images we need to either specifiy the publisher,owner,version,sku or the image id
if we go and check in the Azure Portal -> Image -> "Overview" -> ..... the space for blob uri ---- blank and using the Resource ID in terraform script is not helping
You could check example in the document(Example Usage with Managed Disks and Custom Images (Recommended)).
resource "azurerm_virtual_machine" "test" {
name = "acctvm"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
network_interface_ids = ["${azurerm_network_interface.test.id}"]
vm_size = "Standard_DS1_v2"
# Uncomment this line to delete the OS disk automatically when deleting the VM
# delete_os_disk_on_termination = true
# Uncomment this line to delete the data disks automatically when deleting the VM
# delete_data_disks_on_termination = true
storage_image_reference {
id="${data.azurerm_image.image.id}"
}
storage_os_disk {
name = "myosdisk1"
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}
Note: The id is your managed disk resource ID not blob URL.