@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
283 lines • 11.7 kB
JavaScript
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** 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",
* ],
* });
* ```
* ### Region Disk Hyperdisk Balanced Ha Write Many
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const primary = new gcp.compute.RegionDisk("primary", {
* name: "my-region-hyperdisk",
* type: "hyperdisk-balanced-high-availability",
* region: "us-central1",
* replicaZones: [
* "us-central1-a",
* "us-central1-f",
* ],
* accessMode: "READ_WRITE_MANY",
* });
* ```
*
* ## 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, { ...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["accessMode"] = state?.accessMode;
resourceInputs["asyncPrimaryDisk"] = state?.asyncPrimaryDisk;
resourceInputs["createSnapshotBeforeDestroy"] = state?.createSnapshotBeforeDestroy;
resourceInputs["createSnapshotBeforeDestroyPrefix"] = state?.createSnapshotBeforeDestroyPrefix;
resourceInputs["creationTimestamp"] = state?.creationTimestamp;
resourceInputs["description"] = state?.description;
resourceInputs["diskEncryptionKey"] = state?.diskEncryptionKey;
resourceInputs["diskId"] = state?.diskId;
resourceInputs["effectiveLabels"] = state?.effectiveLabels;
resourceInputs["guestOsFeatures"] = state?.guestOsFeatures;
resourceInputs["interface"] = state?.interface;
resourceInputs["labelFingerprint"] = state?.labelFingerprint;
resourceInputs["labels"] = state?.labels;
resourceInputs["lastAttachTimestamp"] = state?.lastAttachTimestamp;
resourceInputs["lastDetachTimestamp"] = state?.lastDetachTimestamp;
resourceInputs["licenses"] = state?.licenses;
resourceInputs["name"] = state?.name;
resourceInputs["physicalBlockSizeBytes"] = state?.physicalBlockSizeBytes;
resourceInputs["project"] = state?.project;
resourceInputs["provisionedIops"] = state?.provisionedIops;
resourceInputs["provisionedThroughput"] = state?.provisionedThroughput;
resourceInputs["pulumiLabels"] = state?.pulumiLabels;
resourceInputs["region"] = state?.region;
resourceInputs["replicaZones"] = state?.replicaZones;
resourceInputs["selfLink"] = state?.selfLink;
resourceInputs["size"] = state?.size;
resourceInputs["snapshot"] = state?.snapshot;
resourceInputs["sourceDisk"] = state?.sourceDisk;
resourceInputs["sourceDiskId"] = state?.sourceDiskId;
resourceInputs["sourceSnapshotEncryptionKey"] = state?.sourceSnapshotEncryptionKey;
resourceInputs["sourceSnapshotId"] = state?.sourceSnapshotId;
resourceInputs["type"] = state?.type;
resourceInputs["users"] = state?.users;
}
else {
const args = argsOrState;
if (args?.replicaZones === undefined && !opts.urn) {
throw new Error("Missing required property 'replicaZones'");
}
resourceInputs["accessMode"] = args?.accessMode;
resourceInputs["asyncPrimaryDisk"] = args?.asyncPrimaryDisk;
resourceInputs["createSnapshotBeforeDestroy"] = args?.createSnapshotBeforeDestroy;
resourceInputs["createSnapshotBeforeDestroyPrefix"] = args?.createSnapshotBeforeDestroyPrefix;
resourceInputs["description"] = args?.description;
resourceInputs["diskEncryptionKey"] = args?.diskEncryptionKey;
resourceInputs["guestOsFeatures"] = args?.guestOsFeatures;
resourceInputs["interface"] = args?.interface;
resourceInputs["labels"] = args?.labels;
resourceInputs["licenses"] = args?.licenses;
resourceInputs["name"] = args?.name;
resourceInputs["physicalBlockSizeBytes"] = args?.physicalBlockSizeBytes;
resourceInputs["project"] = args?.project;
resourceInputs["provisionedIops"] = args?.provisionedIops;
resourceInputs["provisionedThroughput"] = args?.provisionedThroughput;
resourceInputs["region"] = args?.region;
resourceInputs["replicaZones"] = args?.replicaZones;
resourceInputs["size"] = args?.size;
resourceInputs["snapshot"] = args?.snapshot;
resourceInputs["sourceDisk"] = args?.sourceDisk;
resourceInputs["sourceSnapshotEncryptionKey"] = args?.sourceSnapshotEncryptionKey;
resourceInputs["type"] = args?.type;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["diskId"] = 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
;