UNPKG

@pulumi/vsphere

Version:

A Pulumi package for creating vsphere resources

160 lines 6.9 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.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, { ...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?.accessMode; resourceInputs["accessible"] = state?.accessible; resourceInputs["capacity"] = state?.capacity; resourceInputs["customAttributes"] = state?.customAttributes; resourceInputs["datastoreClusterId"] = state?.datastoreClusterId; resourceInputs["folder"] = state?.folder; resourceInputs["freeSpace"] = state?.freeSpace; resourceInputs["hostSystemIds"] = state?.hostSystemIds; resourceInputs["maintenanceMode"] = state?.maintenanceMode; resourceInputs["multipleHostAccess"] = state?.multipleHostAccess; resourceInputs["name"] = state?.name; resourceInputs["protocolEndpoint"] = state?.protocolEndpoint; resourceInputs["remoteHosts"] = state?.remoteHosts; resourceInputs["remotePath"] = state?.remotePath; resourceInputs["securityType"] = state?.securityType; resourceInputs["tags"] = state?.tags; resourceInputs["type"] = state?.type; resourceInputs["uncommittedSpace"] = state?.uncommittedSpace; resourceInputs["url"] = state?.url; } else { const args = argsOrState; if (args?.hostSystemIds === undefined && !opts.urn) { throw new Error("Missing required property 'hostSystemIds'"); } if (args?.remoteHosts === undefined && !opts.urn) { throw new Error("Missing required property 'remoteHosts'"); } if (args?.remotePath === undefined && !opts.urn) { throw new Error("Missing required property 'remotePath'"); } resourceInputs["accessMode"] = args?.accessMode; resourceInputs["customAttributes"] = args?.customAttributes; resourceInputs["datastoreClusterId"] = args?.datastoreClusterId; resourceInputs["folder"] = args?.folder; resourceInputs["hostSystemIds"] = args?.hostSystemIds; resourceInputs["name"] = args?.name; resourceInputs["remoteHosts"] = args?.remoteHosts; resourceInputs["remotePath"] = args?.remotePath; resourceInputs["securityType"] = args?.securityType; resourceInputs["tags"] = args?.tags; resourceInputs["type"] = args?.type; 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