UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

87 lines 3.72 kB
"use strict"; // *** 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.VolumeAttachment = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Manages attaching a Volume to a Droplet. * * > **NOTE:** Volumes can be attached either directly on the `digitalocean.Droplet` resource, or using the `digitalocean.VolumeAttachment` resource - but the two cannot be used together. If both are used against the same Droplet, the volume attachments will constantly drift. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const foobar = new digitalocean.Volume("foobar", { * region: digitalocean.Region.NYC1, * name: "baz", * size: 100, * initialFilesystemType: digitalocean.FileSystemType.EXT4, * description: "an example volume", * }); * const foobarDroplet = new digitalocean.Droplet("foobar", { * name: "baz", * size: digitalocean.DropletSlug.DropletS1VCPU1GB, * image: "ubuntu-18-04-x64", * region: digitalocean.Region.NYC1, * }); * const foobarVolumeAttachment = new digitalocean.VolumeAttachment("foobar", { * dropletId: foobarDroplet.id, * volumeId: foobar.id, * }); * ``` */ class VolumeAttachment extends pulumi.CustomResource { /** * Get an existing VolumeAttachment 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 VolumeAttachment(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of VolumeAttachment. 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'] === VolumeAttachment.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["dropletId"] = state ? state.dropletId : undefined; resourceInputs["volumeId"] = state ? state.volumeId : undefined; } else { const args = argsOrState; if ((!args || args.dropletId === undefined) && !opts.urn) { throw new Error("Missing required property 'dropletId'"); } if ((!args || args.volumeId === undefined) && !opts.urn) { throw new Error("Missing required property 'volumeId'"); } resourceInputs["dropletId"] = args ? args.dropletId : undefined; resourceInputs["volumeId"] = args ? args.volumeId : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(VolumeAttachment.__pulumiType, name, resourceInputs, opts); } } exports.VolumeAttachment = VolumeAttachment; /** @internal */ VolumeAttachment.__pulumiType = 'digitalocean:index/volumeAttachment:VolumeAttachment'; //# sourceMappingURL=volumeAttachment.js.map