import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Represents a Persistent Disk Snapshot resource. * * Use snapshots to back up data from your persistent disks. Snapshots are * different from public images and custom images, which are used primarily * to create instances or configure instance templates. Snapshots are useful * for periodic backup of the data on your persistent disks. You can create * snapshots from persistent disks even while they are attached to running * instances. * * Snapshots are incremental, so you can create regular snapshots on a * persistent disk faster and at a much lower cost than if you regularly * created a full image of the disk. * * To get more information about Snapshot, see: * * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/snapshots) * * How-to Guides * * [Official Documentation](https://cloud.google.com/compute/docs/disks/create-snapshots) * * > **Warning:** All arguments including the following potentially sensitive * values will be stored in the raw state as plain text: `snapshot_encryption_key.raw_key`, `snapshot_encryption_key.rsa_encrypted_key`, `source_disk_encryption_key.raw_key`, `source_disk_encryption_key.rsa_encrypted_key`. * * ## Example Usage * * ### Snapshot Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const debian = gcp.compute.getImage({ * family: "debian-11", * project: "debian-cloud", * }); * const persistent = new gcp.compute.Disk("persistent", { * name: "debian-disk", * image: debian.then(debian => debian.selfLink), * size: 10, * type: "pd-ssd", * zone: "us-central1-a", * }); * const snapshot = new gcp.compute.Snapshot("snapshot", { * name: "my-snapshot", * sourceDisk: persistent.id, * zone: "us-central1-a", * labels: { * my_label: "value", * }, * storageLocations: ["us-central1"], * }); * ``` * ### Snapshot Chainname * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const debian = gcp.compute.getImage({ * family: "debian-11", * project: "debian-cloud", * }); * const persistent = new gcp.compute.Disk("persistent", { * name: "debian-disk", * image: debian.then(debian => debian.selfLink), * size: 10, * type: "pd-ssd", * zone: "us-central1-a", * }); * const snapshot = new gcp.compute.Snapshot("snapshot", { * name: "my-snapshot", * sourceDisk: persistent.id, * zone: "us-central1-a", * chainName: "snapshot-chain", * labels: { * my_label: "value", * }, * storageLocations: ["us-central1"], * }); * ``` * * ## Import * * Snapshot can be imported using any of these accepted formats: * * * `projects/{{project}}/global/snapshots/{{name}}` * * * `{{project}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, Snapshot can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/snapshot:Snapshot default projects/{{project}}/global/snapshots/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/snapshot:Snapshot default {{project}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/snapshot:Snapshot default {{name}} * ``` */ export declare class Snapshot extends pulumi.CustomResource { /** * Get an existing Snapshot resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: SnapshotState, opts?: pulumi.CustomResourceOptions): Snapshot; /** * Returns true if the given object is an instance of Snapshot. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Snapshot; /** * Creates the new snapshot in the snapshot chain labeled with the * specified name. The chain name must be 1-63 characters long and * comply with RFC1035. This is an uncommon option only for advanced * service owners who needs to create separate snapshot chains, for * example, for chargeback tracking. When you describe your snapshot * resource, this field is visible only if it has a non-empty value. */ readonly chainName: pulumi.Output; /** * Creation timestamp in RFC3339 text format. */ readonly creationTimestamp: pulumi.Output; /** * An optional description of this resource. */ readonly description: pulumi.Output; /** * Size of the snapshot, specified in GB. */ readonly diskSizeGb: pulumi.Output; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ readonly effectiveLabels: pulumi.Output<{ [key: string]: string; }>; /** * The fingerprint used for optimistic locking of this resource. Used * internally during updates. */ readonly labelFingerprint: pulumi.Output; /** * Labels to apply to this Snapshot. * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * A list of public visible licenses that apply to this snapshot. This * can be because the original image had licenses attached (such as a * Windows image). snapshotEncryptionKey nested object Encrypts the * snapshot using a customer-supplied encryption key. */ readonly licenses: pulumi.Output; /** * Name of the resource; provided by the client when the resource is * created. The name must be 1-63 characters long, and comply with * RFC1035. Specifically, the name must be 1-63 characters long and match * the regular expression `a-z?` which means 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. */ readonly name: pulumi.Output; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * The URI of the created resource. */ readonly selfLink: pulumi.Output; /** * Encrypts the snapshot using a customer-supplied encryption key. * After you encrypt a snapshot using a customer-supplied key, you must * provide the same key if you use the snapshot later. For example, you * must provide the encryption key when you create a disk from the * encrypted snapshot in a future request. * Customer-supplied encryption keys do not protect access to metadata of * the snapshot. * If you do not provide an encryption key when creating the snapshot, * then the snapshot will be encrypted using an automatically generated * key and you do not need to provide a key to use the snapshot later. * Structure is documented below. */ readonly snapshotEncryptionKey: pulumi.Output; /** * The unique identifier for the resource. */ readonly snapshotId: pulumi.Output; /** * A reference to the disk used to create this snapshot. */ readonly sourceDisk: pulumi.Output; /** * The customer-supplied encryption key of the source snapshot. Required * if the source snapshot is protected by a customer-supplied encryption * key. * Structure is documented below. */ readonly sourceDiskEncryptionKey: pulumi.Output; /** * A size of the storage used by the snapshot. As snapshots share * storage, this number is expected to change with snapshot * creation/deletion. */ readonly storageBytes: pulumi.Output; /** * Cloud Storage bucket storage location of the snapshot (regional or multi-regional). */ readonly storageLocations: pulumi.Output; /** * A reference to the zone where the disk is hosted. */ readonly zone: pulumi.Output; /** * Create a Snapshot resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: SnapshotArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Snapshot resources. */ export interface SnapshotState { /** * Creates the new snapshot in the snapshot chain labeled with the * specified name. The chain name must be 1-63 characters long and * comply with RFC1035. This is an uncommon option only for advanced * service owners who needs to create separate snapshot chains, for * example, for chargeback tracking. When you describe your snapshot * resource, this field is visible only if it has a non-empty value. */ chainName?: pulumi.Input; /** * Creation timestamp in RFC3339 text format. */ creationTimestamp?: pulumi.Input; /** * An optional description of this resource. */ description?: pulumi.Input; /** * Size of the snapshot, specified in GB. */ diskSizeGb?: pulumi.Input; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ effectiveLabels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * The fingerprint used for optimistic locking of this resource. Used * internally during updates. */ labelFingerprint?: pulumi.Input; /** * Labels to apply to this Snapshot. * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * A list of public visible licenses that apply to this snapshot. This * can be because the original image had licenses attached (such as a * Windows image). snapshotEncryptionKey nested object Encrypts the * snapshot using a customer-supplied encryption key. */ licenses?: pulumi.Input[]>; /** * Name of the resource; provided by the client when the resource is * created. The name must be 1-63 characters long, and comply with * RFC1035. Specifically, the name must be 1-63 characters long and match * the regular expression `a-z?` which means 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. */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * The URI of the created resource. */ selfLink?: pulumi.Input; /** * Encrypts the snapshot using a customer-supplied encryption key. * After you encrypt a snapshot using a customer-supplied key, you must * provide the same key if you use the snapshot later. For example, you * must provide the encryption key when you create a disk from the * encrypted snapshot in a future request. * Customer-supplied encryption keys do not protect access to metadata of * the snapshot. * If you do not provide an encryption key when creating the snapshot, * then the snapshot will be encrypted using an automatically generated * key and you do not need to provide a key to use the snapshot later. * Structure is documented below. */ snapshotEncryptionKey?: pulumi.Input; /** * The unique identifier for the resource. */ snapshotId?: pulumi.Input; /** * A reference to the disk used to create this snapshot. */ sourceDisk?: pulumi.Input; /** * The customer-supplied encryption key of the source snapshot. Required * if the source snapshot is protected by a customer-supplied encryption * key. * Structure is documented below. */ sourceDiskEncryptionKey?: pulumi.Input; /** * A size of the storage used by the snapshot. As snapshots share * storage, this number is expected to change with snapshot * creation/deletion. */ storageBytes?: pulumi.Input; /** * Cloud Storage bucket storage location of the snapshot (regional or multi-regional). */ storageLocations?: pulumi.Input[]>; /** * A reference to the zone where the disk is hosted. */ zone?: pulumi.Input; } /** * The set of arguments for constructing a Snapshot resource. */ export interface SnapshotArgs { /** * Creates the new snapshot in the snapshot chain labeled with the * specified name. The chain name must be 1-63 characters long and * comply with RFC1035. This is an uncommon option only for advanced * service owners who needs to create separate snapshot chains, for * example, for chargeback tracking. When you describe your snapshot * resource, this field is visible only if it has a non-empty value. */ chainName?: pulumi.Input; /** * An optional description of this resource. */ description?: pulumi.Input; /** * Labels to apply to this Snapshot. * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Name of the resource; provided by the client when the resource is * created. The name must be 1-63 characters long, and comply with * RFC1035. Specifically, the name must be 1-63 characters long and match * the regular expression `a-z?` which means 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. */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * Encrypts the snapshot using a customer-supplied encryption key. * After you encrypt a snapshot using a customer-supplied key, you must * provide the same key if you use the snapshot later. For example, you * must provide the encryption key when you create a disk from the * encrypted snapshot in a future request. * Customer-supplied encryption keys do not protect access to metadata of * the snapshot. * If you do not provide an encryption key when creating the snapshot, * then the snapshot will be encrypted using an automatically generated * key and you do not need to provide a key to use the snapshot later. * Structure is documented below. */ snapshotEncryptionKey?: pulumi.Input; /** * A reference to the disk used to create this snapshot. */ sourceDisk: pulumi.Input; /** * The customer-supplied encryption key of the source snapshot. Required * if the source snapshot is protected by a customer-supplied encryption * key. * Structure is documented below. */ sourceDiskEncryptionKey?: pulumi.Input; /** * Cloud Storage bucket storage location of the snapshot (regional or multi-regional). */ storageLocations?: pulumi.Input[]>; /** * A reference to the zone where the disk is hosted. */ zone?: pulumi.Input; }