Skip to content

Data Source: azurermImage

Use this data source to access information about an existing Image.

Example Usage

import * as cdktf from "cdktf";
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const dataAzurermImageSearch = new azurerm.dataAzurermImage.DataAzurermImage(
  this,
  "search",
  {
    name: "search-api",
    resource_group_name: "packerimages",
  }
);
new cdktf.TerraformOutput(this, "image_id", {
  value: dataAzurermImageSearch.id,
});

Argument Reference

  • name - (Optional) The name of the Image.
  • nameRegex - (Optional) Regex pattern of the image to match.
  • sortDescending - (Optional) By default when matching by regex, images are sorted by name in ascending order and the first match is chosen, to sort descending, set this flag.
  • resourceGroupName - The Name of the Resource Group where this Image exists.

Attributes Reference

  • dataDisk - a collection of dataDisk blocks as defined below.
  • name - the name of the Image.
  • location - the Azure Location where this Image exists.
  • osDisk - a osDisk block as defined below.
  • tags - a mapping of tags to assigned to the resource.
  • zoneResilient - is zone resiliency enabled?

osDisk supports the following:

  • blobUri - the URI in Azure storage of the blob used to create the image.
  • caching - the caching mode for the OS Disk, such as readWrite, readOnly, or none.
  • managedDiskId - the ID of the Managed Disk used as the OS Disk Image.
  • osState - the State of the OS used in the Image, such as generalized.
  • osType - the type of Operating System used on the OS Disk. such as linux or windows.
  • sizeGb - the size of the OS Disk in GB.

dataDisk supports the following:

  • blobUri - the URI in Azure storage of the blob used to create the image.
  • caching - the caching mode for the Data Disk, such as readWrite, readOnly, or none.
  • lun - the logical unit number of the data disk.
  • managedDiskId - the ID of the Managed Disk used as the Data Disk Image.
  • sizeGb - the size of this Data Disk in GB.

Timeouts

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

  • read - (Defaults to 5 minutes) Used when retrieving the Image.