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 1-63 characters long, and the first character must be a lowercase letter. All other characters must be a lowercase letter, digit, or -, except the last character, which cannot be a -. (Required)
description The description of the image.
family The name of the image family to which this image belongs. Must be 1-63 characters long, and the first character must be a lowercase letter. All other characters must be a lowercase letter, digit, or -, except the last character, which cannot be a -.
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. Conflicts with source-snapshot, source-disk, and source-image.

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. Conflicts with raw-disk, source-snapshot, and source-image.
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. Conflicts with source-snapshot-encryption-key and source-image-encryption-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)
source-image The source image used to create this image. Conflicts with raw-disk, source-disk, and source-snapshot.
source-image-encryption-key The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. Conflicts with source-snapshot-encryption-key and source-disk-encryption-key.
source-snapshot The source snapshot used to create this image. Conflicts with raw-disk, source-disk, and source-image.
source-snapshot-encryption-key The customer-supplied encryption key of the source snapshot. Required if the source snapshot is protected by a customer-supplied encryption key. Conflicts with source-disk-encryption-key and source-image-encryption-key.

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.