Skip to content

googleComputeImage

Get information about a Google Compute Image. Check that your service account has the computeImageUser role if you want to share custom images from another project. If you want to use public images, do not forget to specify the dedicated project. For more information see the official documentation and its API.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const dataGoogleComputeImageMyImage =
  new google.dataGoogleComputeImage.DataGoogleComputeImage(this, "my_image", {
    family: "debian-11",
    project: "debian-cloud",
  });
new google.computeInstance.ComputeInstance(this, "default", {
  boot_disk: [
    {
      initialize_params: [
        {
          image: dataGoogleComputeImageMyImage.selfLink,
        },
      ],
    },
  ],
});

Argument Reference

The following arguments are supported:

  • name, family or filter - (Required) The name of a specific image or a family. Exactly one of name, family or filter must be specified. If name is specified, it will fetch the corresponding image. If family is specified, it will return the latest image that is part of an image family and is not deprecated. If you specify filter, your filter must return exactly one image. Filter syntax can be found here in the filter section.

  • project - (Optional) The project in which the resource belongs. If it is not provided, the provider project is used. If you are using a public base image, be sure to specify the correct Image Project.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the data source with format projects/{{project}}/global/images/{{name}}
  • selfLink - The URI of the image.
  • name - The name of the image.
  • family - The family name of the image.
  • diskSizeGb - The size of the image when restored onto a persistent disk in gigabytes.
  • archiveSizeBytes - The size of the image tar.gz archive stored in Google Cloud Storage in bytes.
  • imageId - The unique identifier for the image.
  • imageEncryptionKeySha256 - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this image.
  • sourceImageId - The ID value of the image used to create this image.
  • sourceDisk - The URL of the source disk used to create this image.
  • sourceDiskEncryptionKeySha256 - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this image.
  • sourceDiskId - The ID value of the disk used to create this image.
  • creationTimestamp - The creation timestamp in RFC3339 text format.
  • description - An optional description of this image.
  • labels - A map of labels applied to this image.
  • labelFingerprint - A fingerprint for the labels being applied to this image.
  • licenses - A list of applicable license URI.
  • status - The status of the image. Possible values are FAILED, PENDING, or READY.