google::compute-snapshot

Creates a snapshot of a disk.

Example

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

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

    snapshot-encryption-key
        raw-key: "AGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0="
    end

    storage-locations: [
        "us-west1"
    ]
end
google::compute-snapshot region-snapshot-example
    name: "region-snapshot-example"
    source-region-disk: $(google::compute-region-disk region-disk-example)

    storage-locations: [
        "us"
    ]
end

Attributes

Attribute Description
name The name of the snapshot. 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 snapshot.
source-disk The source disk used to create this snapshot. Conflicts with region-source-disk.
source-region-disk The regional source disk used to create this snapshot. Conflicts with source-disk.
snapshot-encryption-key subresource

The encryption key used to encrypt the snapshot. If you do not provide an encryption key when creating the snapshot, the snapshot 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)
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.

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)
labels map Optional labels (key-value pairs) that can be applied to the snapshot. The only characters allowed are lowercase characters, international characters, numbers, -, and _. Key and value must be under 64 characters.
storage-locations list Storage location of the snapshot. Can be regional (eg. us-central1) or multi-regional (eg. us).

Outputs

Attribute Description
status The status of snapshot creation. Values can be: CREATING, UPLOADING, FAILED, READY, or DELETING.
source-disk-id The ID value of the disk used to create the snapshot.
disk-size-gb The size of the disk used to create the snapshot, specified in GB.
storage-bytes The size of the storage used by the snapshot. This is expected to change with snapshot creation/deletion as snapshots share storage.
self-link The fully-qualified URL linking back to the snapshot.
label-fingerprint The fingerprint for the labels being applied to the snapshot, which is updated any time the labels change.