google::compute-image

Creates an image, which is used to create boot disks. You must provide either a source image, source snapshot, source disk, or raw disk when creating an image.

Example

google::compute-image image-disk-example
    name: "image-disk-example"
    description: "image-disk-example-desc"
    source-disk: $(google::compute-disk disk-example)
    family: "image-disk-example-family"
    labels: {
        label-key: 'label-value'
    }

    source-disk-encryption-key
        raw-key: "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0="
    end

    storage-locations: [
        "us-central1"
    ]
end
google::compute-image image-image-example
    name: "image-image-example"
    description: "image-image-example-desc"
    source-image: $(google::compute-image image-disk-example)

    storage-locations: [
        "us"
    ]
end

Attributes

Attribute Description
name The name of the image. Must be a string 1-63 characters long and the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. Valid values satisfy the regex: [(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)]. (Required)
description The description of the image.
family The name of the image family to which this image belongs. Must be a string 1-63 characters long and the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. Valid values satisfy the regex: [(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)].
labels map Optional labels (key-value pairs) that can be applied to the image. The only characters allowed are lowercase characters, international characters, numbers, -, and _. Key and value must be under 64 characters.
raw-disk subresource

The parameters of the raw disk image. Cannot be set if any of source-snapshot, source-disk or source-image is set.

source
The full Google Cloud Storage URL of the storage file that should be the source of the image. File must use .tar.gz extension and the file inside the archive must be named disk.raw. See Manually importing virtual disks for instructions on how to create the file. (Required)
image-encryption-key subresource

The encryption key used to encrypt the image. If you do not provide an encryption key when creating the image, the image will be encrypted using an automatically generated key.

raw-key
The 256-bit encryption key, encoded in RFC 4648 base64, that protects this resource. See Encrypt disks with customer-supplied encryption keys. (Required)
storage-locations list Storage location of the image. Can be regional (eg. us-central1) or multi-regional (eg. us). Defaults to storage location of the source.
source-disk The source disk used to create this image. Regional disks are not yet supported when creating images. Images can not be created from disks that are currently in use by an instance. Cannot be set if any of raw-disk, source-snapshot or source-image is set.
source-disk-encryption-key subresource

The encryption key of the source disk. This is required if the source disk is protected by a customer-supplied encryption key. Cannot be set if any of source-snapshot-encryption-key or source-image-encryption-key is set.

raw-key
The 256-bit encryption key, encoded in RFC 4648 base64, that protects this resource. See Encrypt disks with customer-supplied encryption keys. (Required)
source-image The source image used to create this image. Cannot be set if any of raw-disk, source-disk or source-snapshot is set.
source-image-encryption-key subresource

The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. Cannot be set if any of source-snapshot-encryption-key or source-disk-encryption-key is set.

raw-key
The 256-bit encryption key, encoded in RFC 4648 base64, that protects this resource. See Encrypt disks with customer-supplied encryption keys. (Required)
source-snapshot The source snapshot used to create this image. Cannot be set if any of raw-disk, source-disk or source-image is set.
source-snapshot-encryption-key subresource

The customer-supplied encryption key of the source snapshot. Required if the source snapshot is protected by a customer-supplied encryption key. Cannot be set if any of source-disk-encryption-key or source-image-encryption-key is set.

raw-key
The 256-bit encryption key, encoded in RFC 4648 base64, that protects this resource. See Encrypt disks with customer-supplied encryption keys. (Required)

Outputs

Attribute Description
archive-size-bytes Size of the image archive stored in bytes.
disk-size-gb The size of the image when restored onto a persistent disk, specified in GB.
label-fingerprint The fingerprint for the labels being applied to the image, which is updated any time the labels change.
self-link The fully-qualified URL linking back to the image.
source-disk-id The ID value of the disk used to create this image.
source-image-id The ID value of the image used to create this image.
source-snapshot-id The ID value of the snapshot used to create this image.
status The status of image creation. Values can be: PENDING, FAILED, or READY.