UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

114 lines 3.74 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.getVolumeOutput = exports.getVolume = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Get information on a volume for use in other resources. This data source provides * all of the volumes properties as configured on your DigitalOcean account. This is * useful if the volume in question is not managed by the provider or you need to utilize * any of the volumes data. * * An error is triggered if the provided volume name does not exist. * * ## Example Usage * * Get the volume: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const example = digitalocean.getVolume({ * name: "app-data", * region: "nyc3", * }); * ``` * * Reuse the data about a volume to attach it to a Droplet: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const example = digitalocean.getVolume({ * name: "app-data", * region: "nyc3", * }); * const exampleDroplet = new digitalocean.Droplet("example", { * name: "foo", * size: digitalocean.DropletSlug.DropletS1VCPU1GB, * image: "ubuntu-18-04-x64", * region: digitalocean.Region.NYC3, * }); * const foobar = new digitalocean.VolumeAttachment("foobar", { * dropletId: exampleDroplet.id, * volumeId: example.then(example => example.id), * }); * ``` */ function getVolume(args, opts) { opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {}); return pulumi.runtime.invoke("digitalocean:index/getVolume:getVolume", { "description": args.description, "name": args.name, "region": args.region, }, opts); } exports.getVolume = getVolume; /** * Get information on a volume for use in other resources. This data source provides * all of the volumes properties as configured on your DigitalOcean account. This is * useful if the volume in question is not managed by the provider or you need to utilize * any of the volumes data. * * An error is triggered if the provided volume name does not exist. * * ## Example Usage * * Get the volume: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const example = digitalocean.getVolume({ * name: "app-data", * region: "nyc3", * }); * ``` * * Reuse the data about a volume to attach it to a Droplet: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const example = digitalocean.getVolume({ * name: "app-data", * region: "nyc3", * }); * const exampleDroplet = new digitalocean.Droplet("example", { * name: "foo", * size: digitalocean.DropletSlug.DropletS1VCPU1GB, * image: "ubuntu-18-04-x64", * region: digitalocean.Region.NYC3, * }); * const foobar = new digitalocean.VolumeAttachment("foobar", { * dropletId: exampleDroplet.id, * volumeId: example.then(example => example.id), * }); * ``` */ function getVolumeOutput(args, opts) { opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {}); return pulumi.runtime.invokeOutput("digitalocean:index/getVolume:getVolume", { "description": args.description, "name": args.name, "region": args.region, }, opts); } exports.getVolumeOutput = getVolumeOutput; //# sourceMappingURL=getVolume.js.map