@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
451 lines (450 loc) • 17.6 kB
TypeScript
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)
*
* ## 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<pulumi.ID>, 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<string | undefined>;
/**
* Creation timestamp in RFC3339 text format.
*/
readonly creationTimestamp: pulumi.Output<string>;
/**
* An optional description of this resource.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* Size of the snapshot, specified in GB.
*/
readonly diskSizeGb: pulumi.Output<number>;
/**
* 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<string>;
/**
* 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<string[]>;
/**
* 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<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
readonly project: pulumi.Output<string>;
/**
* 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<string>;
/**
* 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<outputs.compute.SnapshotSnapshotEncryptionKey | undefined>;
/**
* The unique identifier for the resource.
*/
readonly snapshotId: pulumi.Output<number>;
/**
* A reference to the disk used to create this snapshot.
*
*
* - - -
*/
readonly sourceDisk: pulumi.Output<string>;
/**
* 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<outputs.compute.SnapshotSourceDiskEncryptionKey | undefined>;
/**
* 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<number>;
/**
* Cloud Storage bucket storage location of the snapshot (regional or multi-regional).
*/
readonly storageLocations: pulumi.Output<string[]>;
/**
* A reference to the zone where the disk is hosted.
*/
readonly zone: pulumi.Output<string>;
/**
* 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<string>;
/**
* Creation timestamp in RFC3339 text format.
*/
creationTimestamp?: pulumi.Input<string>;
/**
* An optional description of this resource.
*/
description?: pulumi.Input<string>;
/**
* Size of the snapshot, specified in GB.
*/
diskSizeGb?: pulumi.Input<number>;
/**
* 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<string>;
}>;
/**
* The fingerprint used for optimistic locking of this resource. Used
* internally during updates.
*/
labelFingerprint?: pulumi.Input<string>;
/**
* 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<string>;
}>;
/**
* 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<pulumi.Input<string>[]>;
/**
* 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<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* The combination of labels configured directly on the resource
* and default labels configured on the provider.
*/
pulumiLabels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* The URI of the created resource.
*/
selfLink?: pulumi.Input<string>;
/**
* 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<inputs.compute.SnapshotSnapshotEncryptionKey>;
/**
* The unique identifier for the resource.
*/
snapshotId?: pulumi.Input<number>;
/**
* A reference to the disk used to create this snapshot.
*
*
* - - -
*/
sourceDisk?: pulumi.Input<string>;
/**
* 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<inputs.compute.SnapshotSourceDiskEncryptionKey>;
/**
* 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<number>;
/**
* Cloud Storage bucket storage location of the snapshot (regional or multi-regional).
*/
storageLocations?: pulumi.Input<pulumi.Input<string>[]>;
/**
* A reference to the zone where the disk is hosted.
*/
zone?: pulumi.Input<string>;
}
/**
* 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<string>;
/**
* An optional description of this resource.
*/
description?: pulumi.Input<string>;
/**
* 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<string>;
}>;
/**
* 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<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* 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<inputs.compute.SnapshotSnapshotEncryptionKey>;
/**
* A reference to the disk used to create this snapshot.
*
*
* - - -
*/
sourceDisk: pulumi.Input<string>;
/**
* 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<inputs.compute.SnapshotSourceDiskEncryptionKey>;
/**
* Cloud Storage bucket storage location of the snapshot (regional or multi-regional).
*/
storageLocations?: pulumi.Input<pulumi.Input<string>[]>;
/**
* A reference to the zone where the disk is hosted.
*/
zone?: pulumi.Input<string>;
}