UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

260 lines • 13.1 kB
"use strict"; // *** 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.Disk = 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 Disk, see: * * * [API documentation](https://cloud.google.com/compute/docs/reference/v1/disks) * * How-to Guides * * [Adding a persistent disk](https://cloud.google.com/compute/docs/disks/add-persistent-disk) * * ## Example Usage * * ### Disk Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Disk("default", { * name: "test-disk", * type: "pd-ssd", * zone: "us-central1-a", * image: "debian-11-bullseye-v20220719", * labels: { * environment: "dev", * }, * physicalBlockSizeBytes: 4096, * }); * ``` * ### Disk Async * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.compute.Disk("primary", { * name: "async-test-disk", * type: "pd-ssd", * zone: "us-central1-a", * physicalBlockSizeBytes: 4096, * }); * const secondary = new gcp.compute.Disk("secondary", { * name: "async-secondary-test-disk", * type: "pd-ssd", * zone: "us-east1-c", * asyncPrimaryDisk: { * disk: primary.id, * }, * physicalBlockSizeBytes: 4096, * }); * ``` * ### Disk Features * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Disk("default", { * name: "test-disk-features", * type: "pd-ssd", * zone: "us-central1-a", * labels: { * environment: "dev", * }, * 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"], * physicalBlockSizeBytes: 4096, * }); * ``` * * ## Import * * Disk can be imported using any of these accepted formats: * * * `projects/{{project}}/zones/{{zone}}/disks/{{name}}` * * * `{{project}}/{{zone}}/{{name}}` * * * `{{zone}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, Disk can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/disk:Disk default projects/{{project}}/zones/{{zone}}/disks/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/disk:Disk default {{project}}/{{zone}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/disk:Disk default {{zone}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/disk:Disk default {{name}} * ``` */ class Disk extends pulumi.CustomResource { /** * Get an existing Disk 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 Disk(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Disk. 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'] === Disk.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["accessMode"] = state ? state.accessMode : undefined; resourceInputs["architecture"] = state ? state.architecture : undefined; 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["diskId"] = state ? state.diskId : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["enableConfidentialCompute"] = state ? state.enableConfidentialCompute : undefined; resourceInputs["guestOsFeatures"] = state ? state.guestOsFeatures : undefined; resourceInputs["image"] = state ? state.image : 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["multiWriter"] = state ? state.multiWriter : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["params"] = state ? state.params : undefined; resourceInputs["physicalBlockSizeBytes"] = state ? state.physicalBlockSizeBytes : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["provisionedIops"] = state ? state.provisionedIops : undefined; resourceInputs["provisionedThroughput"] = state ? state.provisionedThroughput : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["resourcePolicies"] = state ? state.resourcePolicies : 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["sourceImageEncryptionKey"] = state ? state.sourceImageEncryptionKey : undefined; resourceInputs["sourceImageId"] = state ? state.sourceImageId : undefined; resourceInputs["sourceInstantSnapshot"] = state ? state.sourceInstantSnapshot : undefined; resourceInputs["sourceInstantSnapshotId"] = state ? state.sourceInstantSnapshotId : undefined; resourceInputs["sourceSnapshotEncryptionKey"] = state ? state.sourceSnapshotEncryptionKey : undefined; resourceInputs["sourceSnapshotId"] = state ? state.sourceSnapshotId : undefined; resourceInputs["sourceStorageObject"] = state ? state.sourceStorageObject : undefined; resourceInputs["storagePool"] = state ? state.storagePool : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["users"] = state ? state.users : undefined; resourceInputs["zone"] = state ? state.zone : undefined; } else { const args = argsOrState; resourceInputs["accessMode"] = args ? args.accessMode : undefined; resourceInputs["architecture"] = args ? args.architecture : undefined; 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["enableConfidentialCompute"] = args ? args.enableConfidentialCompute : undefined; resourceInputs["guestOsFeatures"] = args ? args.guestOsFeatures : undefined; resourceInputs["image"] = args ? args.image : undefined; resourceInputs["interface"] = args ? args.interface : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["licenses"] = args ? args.licenses : undefined; resourceInputs["multiWriter"] = args ? args.multiWriter : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["params"] = args ? args.params : undefined; resourceInputs["physicalBlockSizeBytes"] = args ? args.physicalBlockSizeBytes : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["provisionedIops"] = args ? args.provisionedIops : undefined; resourceInputs["provisionedThroughput"] = args ? args.provisionedThroughput : undefined; resourceInputs["resourcePolicies"] = args ? args.resourcePolicies : undefined; resourceInputs["size"] = args ? args.size : undefined; resourceInputs["snapshot"] = args ? args.snapshot : undefined; resourceInputs["sourceDisk"] = args ? args.sourceDisk : undefined; resourceInputs["sourceImageEncryptionKey"] = args ? args.sourceImageEncryptionKey : undefined; resourceInputs["sourceInstantSnapshot"] = args ? args.sourceInstantSnapshot : undefined; resourceInputs["sourceSnapshotEncryptionKey"] = args ? args.sourceSnapshotEncryptionKey : undefined; resourceInputs["sourceStorageObject"] = args ? args.sourceStorageObject : undefined; resourceInputs["storagePool"] = args ? args.storagePool : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["zone"] = args ? args.zone : undefined; 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["sourceImageId"] = undefined /*out*/; resourceInputs["sourceInstantSnapshotId"] = 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(Disk.__pulumiType, name, resourceInputs, opts); } } exports.Disk = Disk; /** @internal */ Disk.__pulumiType = 'gcp:compute/disk:Disk'; //# sourceMappingURL=disk.js.map