@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
258 lines • 11.6 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.RegionDisk = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Persistent disks are durable storage devices that function similarly to
* the physical disks in a desktop or a server. Compute Engine manages the
* hardware behind these devices to ensure data redundancy and optimize
* performance for you. Persistent disks are available as either standard
* hard disk drives (HDD) or solid-state drives (SSD).
*
* Persistent disks are located independently from your virtual machine
* instances, so you can detach or move persistent disks to keep your data
* even after you delete your instances. Persistent disk performance scales
* automatically with size, so you can resize your existing persistent disks
* or add more persistent disks to an instance to meet your performance and
* storage space requirements.
*
* Add a persistent disk to your instance when you need reliable and
* affordable storage with consistent performance characteristics.
*
* To get more information about RegionDisk, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/regionDisks)
* * How-to Guides
* * [Adding or Resizing Regional Persistent Disks](https://cloud.google.com/compute/docs/disks/regional-persistent-disk)
*
* > **Warning:** All arguments including the following potentially sensitive
* values will be stored in the raw state as plain text: `disk_encryption_key.raw_key`, `disk_encryption_key.rsa_encrypted_key`.
*
* ## Example Usage
*
* ### Region Disk Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const disk = new gcp.compute.Disk("disk", {
* name: "my-disk",
* image: "debian-cloud/debian-11",
* size: 50,
* type: "pd-ssd",
* zone: "us-central1-a",
* });
* const snapdisk = new gcp.compute.Snapshot("snapdisk", {
* name: "my-snapshot",
* sourceDisk: disk.name,
* zone: "us-central1-a",
* });
* const regiondisk = new gcp.compute.RegionDisk("regiondisk", {
* name: "my-region-disk",
* snapshot: snapdisk.id,
* type: "pd-ssd",
* region: "us-central1",
* physicalBlockSizeBytes: 4096,
* replicaZones: [
* "us-central1-a",
* "us-central1-f",
* ],
* });
* ```
* ### Region Disk Async
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const primary = new gcp.compute.RegionDisk("primary", {
* name: "primary-region-disk",
* type: "pd-ssd",
* region: "us-central1",
* physicalBlockSizeBytes: 4096,
* replicaZones: [
* "us-central1-a",
* "us-central1-f",
* ],
* });
* const secondary = new gcp.compute.RegionDisk("secondary", {
* name: "secondary-region-disk",
* type: "pd-ssd",
* region: "us-east1",
* physicalBlockSizeBytes: 4096,
* asyncPrimaryDisk: {
* disk: primary.id,
* },
* replicaZones: [
* "us-east1-b",
* "us-east1-c",
* ],
* });
* ```
* ### Region Disk Features
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const regiondisk = new gcp.compute.RegionDisk("regiondisk", {
* name: "my-region-features-disk",
* type: "pd-ssd",
* region: "us-central1",
* physicalBlockSizeBytes: 4096,
* guestOsFeatures: [
* {
* type: "SECURE_BOOT",
* },
* {
* type: "MULTI_IP_SUBNET",
* },
* {
* type: "WINDOWS",
* },
* ],
* licenses: ["https://www.googleapis.com/compute/v1/projects/windows-cloud/global/licenses/windows-server-core"],
* replicaZones: [
* "us-central1-a",
* "us-central1-f",
* ],
* });
* ```
*
* ## Import
*
* RegionDisk can be imported using any of these accepted formats:
*
* * `projects/{{project}}/regions/{{region}}/disks/{{name}}`
*
* * `{{project}}/{{region}}/{{name}}`
*
* * `{{region}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, RegionDisk can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/regionDisk:RegionDisk default projects/{{project}}/regions/{{region}}/disks/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/regionDisk:RegionDisk default {{project}}/{{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/regionDisk:RegionDisk default {{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/regionDisk:RegionDisk default {{name}}
* ```
*/
class RegionDisk extends pulumi.CustomResource {
/**
* Get an existing RegionDisk 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, id, state, opts) {
return new RegionDisk(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of RegionDisk. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === RegionDisk.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["asyncPrimaryDisk"] = state ? state.asyncPrimaryDisk : undefined;
resourceInputs["createSnapshotBeforeDestroy"] = state ? state.createSnapshotBeforeDestroy : undefined;
resourceInputs["createSnapshotBeforeDestroyPrefix"] = state ? state.createSnapshotBeforeDestroyPrefix : undefined;
resourceInputs["creationTimestamp"] = state ? state.creationTimestamp : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["diskEncryptionKey"] = state ? state.diskEncryptionKey : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["guestOsFeatures"] = state ? state.guestOsFeatures : undefined;
resourceInputs["interface"] = state ? state.interface : undefined;
resourceInputs["labelFingerprint"] = state ? state.labelFingerprint : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["lastAttachTimestamp"] = state ? state.lastAttachTimestamp : undefined;
resourceInputs["lastDetachTimestamp"] = state ? state.lastDetachTimestamp : undefined;
resourceInputs["licenses"] = state ? state.licenses : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["physicalBlockSizeBytes"] = state ? state.physicalBlockSizeBytes : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["replicaZones"] = state ? state.replicaZones : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["size"] = state ? state.size : undefined;
resourceInputs["snapshot"] = state ? state.snapshot : undefined;
resourceInputs["sourceDisk"] = state ? state.sourceDisk : undefined;
resourceInputs["sourceDiskId"] = state ? state.sourceDiskId : undefined;
resourceInputs["sourceSnapshotEncryptionKey"] = state ? state.sourceSnapshotEncryptionKey : undefined;
resourceInputs["sourceSnapshotId"] = state ? state.sourceSnapshotId : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["users"] = state ? state.users : undefined;
}
else {
const args = argsOrState;
if ((!args || args.replicaZones === undefined) && !opts.urn) {
throw new Error("Missing required property 'replicaZones'");
}
resourceInputs["asyncPrimaryDisk"] = args ? args.asyncPrimaryDisk : undefined;
resourceInputs["createSnapshotBeforeDestroy"] = args ? args.createSnapshotBeforeDestroy : undefined;
resourceInputs["createSnapshotBeforeDestroyPrefix"] = args ? args.createSnapshotBeforeDestroyPrefix : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["diskEncryptionKey"] = args ? args.diskEncryptionKey : undefined;
resourceInputs["guestOsFeatures"] = args ? args.guestOsFeatures : undefined;
resourceInputs["interface"] = args ? args.interface : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["licenses"] = args ? args.licenses : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["physicalBlockSizeBytes"] = args ? args.physicalBlockSizeBytes : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["replicaZones"] = args ? args.replicaZones : undefined;
resourceInputs["size"] = args ? args.size : undefined;
resourceInputs["snapshot"] = args ? args.snapshot : undefined;
resourceInputs["sourceDisk"] = args ? args.sourceDisk : undefined;
resourceInputs["sourceSnapshotEncryptionKey"] = args ? args.sourceSnapshotEncryptionKey : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["labelFingerprint"] = undefined /*out*/;
resourceInputs["lastAttachTimestamp"] = undefined /*out*/;
resourceInputs["lastDetachTimestamp"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
resourceInputs["sourceDiskId"] = undefined /*out*/;
resourceInputs["sourceSnapshotId"] = undefined /*out*/;
resourceInputs["users"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(RegionDisk.__pulumiType, name, resourceInputs, opts);
}
}
exports.RegionDisk = RegionDisk;
/** @internal */
RegionDisk.__pulumiType = 'gcp:compute/regionDisk:RegionDisk';
//# sourceMappingURL=regionDisk.js.map