@pulumi/openstack
Version:
A Pulumi package for creating and managing OpenStack cloud resources.
145 lines • 6.8 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.VolumeAttach = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* > **Note:** This resource usually requires admin privileges.
*
* > **Note:** This resource does not actually attach a volume to an instance.
* Please use the `openstack.compute.VolumeAttach` resource for that.
*
* > **Note:** All arguments including the `data` computed attribute will be
* stored in the raw state as plain-text. Read more about sensitive data in
* state.
*
* Creates a general purpose attachment connection to a Block
* Storage volume using the OpenStack Block Storage (Cinder) v3 API.
*
* Depending on your Block Storage service configuration, this
* resource can assist in attaching a volume to a non-OpenStack resource
* such as a bare-metal server or a remote virtual machine in a
* different cloud provider.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const volume1 = new openstack.blockstorage.Volume("volume_1", {
* name: "volume_1",
* size: 1,
* });
* const va1 = new openstack.blockstorage.VolumeAttach("va_1", {
* volumeId: volume1.id,
* device: "auto",
* hostName: "devstack",
* ipAddress: "192.168.255.10",
* initiator: "iqn.1993-08.org.debian:01:e9861fb1859",
* osType: "linux2",
* platform: "x86_64",
* });
* ```
*
* ## Volume Connection Data
*
* Upon creation of this resource, a `data` exported attribute will be available.
* This attribute is a set of key/value pairs that contains the information
* required to complete the block storage connection.
*
* As an example, creating an iSCSI-based volume will return the following:
*
* This information can then be fed into a provisioner or a template shell script,
* where the final result would look something like:
*
* The contents of `data` will vary from each Block Storage service. You must have
* a good understanding of how the service is configured and how to make the
* appropriate final connection. However, if used correctly, this has the
* flexibility to be able to attach OpenStack Block Storage volumes to
* non-OpenStack resources.
*
* ## Import
*
* It is not possible to import this resource.
*/
class VolumeAttach extends pulumi.CustomResource {
/**
* Get an existing VolumeAttach 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 VolumeAttach(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of VolumeAttach. 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'] === VolumeAttach.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["attachMode"] = state ? state.attachMode : undefined;
resourceInputs["data"] = state ? state.data : undefined;
resourceInputs["device"] = state ? state.device : undefined;
resourceInputs["driverVolumeType"] = state ? state.driverVolumeType : undefined;
resourceInputs["hostName"] = state ? state.hostName : undefined;
resourceInputs["initiator"] = state ? state.initiator : undefined;
resourceInputs["ipAddress"] = state ? state.ipAddress : undefined;
resourceInputs["mountPointBase"] = state ? state.mountPointBase : undefined;
resourceInputs["multipath"] = state ? state.multipath : undefined;
resourceInputs["osType"] = state ? state.osType : undefined;
resourceInputs["platform"] = state ? state.platform : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["volumeId"] = state ? state.volumeId : undefined;
resourceInputs["wwnn"] = state ? state.wwnn : undefined;
resourceInputs["wwpns"] = state ? state.wwpns : undefined;
}
else {
const args = argsOrState;
if ((!args || args.hostName === undefined) && !opts.urn) {
throw new Error("Missing required property 'hostName'");
}
if ((!args || args.volumeId === undefined) && !opts.urn) {
throw new Error("Missing required property 'volumeId'");
}
resourceInputs["attachMode"] = args ? args.attachMode : undefined;
resourceInputs["device"] = args ? args.device : undefined;
resourceInputs["hostName"] = args ? args.hostName : undefined;
resourceInputs["initiator"] = args ? args.initiator : undefined;
resourceInputs["ipAddress"] = args ? args.ipAddress : undefined;
resourceInputs["multipath"] = args ? args.multipath : undefined;
resourceInputs["osType"] = args ? args.osType : undefined;
resourceInputs["platform"] = args ? args.platform : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["volumeId"] = args ? args.volumeId : undefined;
resourceInputs["wwnn"] = args ? args.wwnn : undefined;
resourceInputs["wwpns"] = args ? args.wwpns : undefined;
resourceInputs["data"] = undefined /*out*/;
resourceInputs["driverVolumeType"] = undefined /*out*/;
resourceInputs["mountPointBase"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["data"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(VolumeAttach.__pulumiType, name, resourceInputs, opts);
}
}
exports.VolumeAttach = VolumeAttach;
/** @internal */
VolumeAttach.__pulumiType = 'openstack:blockstorage/volumeAttach:VolumeAttach';
//# sourceMappingURL=volumeAttach.js.map