azurerm_image

Manages a custom virtual machine image that can be used to create virtual machines.

Example Usage

data "azurerm_virtual_machine" "example" {
  name                = "examplevm"
  resource_group_name = "example-resources"
}

resource "azurerm_image" "example" {
  name                      = "exampleimage"
  location                  = data.azurerm_virtual_machine.example.location
  resource_group_name       = data.azurerm_virtual_machine.example.name
  source_virtual_machine_id = data.azurerm_virtual_machine.example.id
}

Argument Reference

The following arguments are supported:


The os_disk block supports the following:


The data_disk block supports the following:

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

Images can be imported using the resource id, e.g.

terraform import azurerm_image.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/images/image1