@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
160 lines • 7.54 kB
JavaScript
;
// *** 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.NasDatastore = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* The `vsphere.NasDatastore` resource can be used to create and manage NAS
* datastores on an ESXi host or a set of hosts. The resource supports mounting
* NFS v3 and v4.1 shares to be used as datastores.
*
* > **NOTE:** Unlike `vsphere.VmfsDatastore`, a NAS
* datastore is only mounted on the hosts you choose to mount it on. To mount on
* multiple hosts, you must specify each host that you want to add in the
* `hostSystemIds` argument.
*
* ## Example Usage
*
* The following example would set up a NFS v3 share on 3 hosts connected through
* vCenter in the same datacenter - `esxi1`, `esxi2`, and `esxi3`. The remote host
* is named `nfs` and has `/export/test` exported.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const config = new pulumi.Config();
* const hosts = config.getObject<any>("hosts") || [
* "esxi-01.example.com",
* "esxi-02.example.com",
* "esxi-03.example.com",
* ];
* const datacenter = vsphere.getDatacenter({
* name: "dc-01",
* });
* const hostsGetHost = (new Array(hosts.length)).map((_, i) => i).map(__index => (vsphere.getHost({
* name: hosts[__index],
* datacenterId: _arg0_.id,
* })));
* const datastore = new vsphere.NasDatastore("datastore", {
* name: "test",
* hostSystemIds: [esxiHosts.map(__item => __item.id)],
* type: "NFS",
* remoteHosts: ["nfs"],
* remotePath: "/export/test",
* });
* ```
*
* ## Import
*
* An existing NAS datastore can be imported into this resource via
*
* its managed object ID, via the following command:
*
* [docs-import]: https://developer.hashicorp.com/terraform/cli/import
*
* ```sh
* $ pulumi import vsphere:index/nasDatastore:NasDatastore datastore datastore-123
* ```
*
* You need a tool like [`govc`][ext-govc] that can display managed object IDs.
*
* [ext-govc]: https://github.com/vmware/govmomi/tree/master/govc
*
* In the case of govc, you can locate a managed object ID from an inventory path
*
* by doing the following:
*
* $ govc ls -i /dc/datastore/terraform-test
*
* Datastore:datastore-123
*/
class NasDatastore extends pulumi.CustomResource {
/**
* Get an existing NasDatastore 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 NasDatastore(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of NasDatastore. 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'] === NasDatastore.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessMode"] = state ? state.accessMode : undefined;
resourceInputs["accessible"] = state ? state.accessible : undefined;
resourceInputs["capacity"] = state ? state.capacity : undefined;
resourceInputs["customAttributes"] = state ? state.customAttributes : undefined;
resourceInputs["datastoreClusterId"] = state ? state.datastoreClusterId : undefined;
resourceInputs["folder"] = state ? state.folder : undefined;
resourceInputs["freeSpace"] = state ? state.freeSpace : undefined;
resourceInputs["hostSystemIds"] = state ? state.hostSystemIds : undefined;
resourceInputs["maintenanceMode"] = state ? state.maintenanceMode : undefined;
resourceInputs["multipleHostAccess"] = state ? state.multipleHostAccess : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["protocolEndpoint"] = state ? state.protocolEndpoint : undefined;
resourceInputs["remoteHosts"] = state ? state.remoteHosts : undefined;
resourceInputs["remotePath"] = state ? state.remotePath : undefined;
resourceInputs["securityType"] = state ? state.securityType : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["uncommittedSpace"] = state ? state.uncommittedSpace : undefined;
resourceInputs["url"] = state ? state.url : undefined;
}
else {
const args = argsOrState;
if ((!args || args.hostSystemIds === undefined) && !opts.urn) {
throw new Error("Missing required property 'hostSystemIds'");
}
if ((!args || args.remoteHosts === undefined) && !opts.urn) {
throw new Error("Missing required property 'remoteHosts'");
}
if ((!args || args.remotePath === undefined) && !opts.urn) {
throw new Error("Missing required property 'remotePath'");
}
resourceInputs["accessMode"] = args ? args.accessMode : undefined;
resourceInputs["customAttributes"] = args ? args.customAttributes : undefined;
resourceInputs["datastoreClusterId"] = args ? args.datastoreClusterId : undefined;
resourceInputs["folder"] = args ? args.folder : undefined;
resourceInputs["hostSystemIds"] = args ? args.hostSystemIds : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["remoteHosts"] = args ? args.remoteHosts : undefined;
resourceInputs["remotePath"] = args ? args.remotePath : undefined;
resourceInputs["securityType"] = args ? args.securityType : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["accessible"] = undefined /*out*/;
resourceInputs["capacity"] = undefined /*out*/;
resourceInputs["freeSpace"] = undefined /*out*/;
resourceInputs["maintenanceMode"] = undefined /*out*/;
resourceInputs["multipleHostAccess"] = undefined /*out*/;
resourceInputs["protocolEndpoint"] = undefined /*out*/;
resourceInputs["uncommittedSpace"] = undefined /*out*/;
resourceInputs["url"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NasDatastore.__pulumiType, name, resourceInputs, opts);
}
}
exports.NasDatastore = NasDatastore;
/** @internal */
NasDatastore.__pulumiType = 'vsphere:index/nasDatastore:NasDatastore';
//# sourceMappingURL=nasDatastore.js.map