@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
177 lines • 9.3 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.DatastoreCluster = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* The `vsphere.DatastoreCluster` resource can be used to create and manage
* datastore clusters. This can be used to create groups of datastores with a
* shared management interface, allowing for resource control and load balancing
* through Storage DRS.
*
* For more information on vSphere datastore clusters and Storage DRS, see [this
* page][ref-vsphere-datastore-clusters].
*
* [ref-vsphere-datastore-clusters]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-resource-management-8-0/creating-a-datastore-cluster.html
*
* > **NOTE:** This resource requires vCenter and is not available on direct ESXi
* connections.
*
* > **NOTE:** Storage DRS requires a vSphere Enterprise Plus license.
*
* ## Example Usage
*
* The following example sets up a datastore cluster and enables Storage DRS with
* the default settings. It then creates two NAS datastores using the
* `vsphere.NasDatastore` resource and assigns them to
* the datastore cluster.
*
* ```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({});
* const hostsGetHost = (new Array(hosts.length)).map((_, i) => i).map(__index => (vsphere.getHost({
* name: hosts[__index],
* datacenterId: _arg0_.id,
* })));
* const datastoreCluster = new vsphere.DatastoreCluster("datastore_cluster", {
* name: "datastore-cluster-test",
* datacenterId: datacenter.then(datacenter => datacenter.id),
* sdrsEnabled: true,
* });
* const datastore1 = new vsphere.NasDatastore("datastore1", {
* name: "datastore-test1",
* hostSystemIds: [esxiHosts.map(__item => __item.id)],
* datastoreClusterId: datastoreCluster.id,
* type: "NFS",
* remoteHosts: ["nfs"],
* remotePath: "/export/test1",
* });
* const datastore2 = new vsphere.NasDatastore("datastore2", {
* name: "datastore-test2",
* hostSystemIds: [esxiHosts.map(__item => __item.id)],
* datastoreClusterId: datastoreCluster.id,
* type: "NFS",
* remoteHosts: ["nfs"],
* remotePath: "/export/test2",
* });
* ```
*
* ## Import
*
* An existing datastore cluster can be imported into this resource
*
* via the path to the cluster, via the following command:
*
* [docs-import]: https://developer.hashicorp.com/terraform/cli/import
*
* ```sh
* $ pulumi import vsphere:index/datastoreCluster:DatastoreCluster datastore_cluster /dc1/datastore/ds-cluster
* ```
*
* The above would import the datastore cluster named `ds-cluster` that is located
*
* in the `dc1` datacenter.
*/
class DatastoreCluster extends pulumi.CustomResource {
/**
* Get an existing DatastoreCluster 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 DatastoreCluster(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of DatastoreCluster. 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'] === DatastoreCluster.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["customAttributes"] = state?.customAttributes;
resourceInputs["datacenterId"] = state?.datacenterId;
resourceInputs["folder"] = state?.folder;
resourceInputs["name"] = state?.name;
resourceInputs["sdrsAdvancedOptions"] = state?.sdrsAdvancedOptions;
resourceInputs["sdrsAutomationLevel"] = state?.sdrsAutomationLevel;
resourceInputs["sdrsDefaultIntraVmAffinity"] = state?.sdrsDefaultIntraVmAffinity;
resourceInputs["sdrsEnabled"] = state?.sdrsEnabled;
resourceInputs["sdrsFreeSpaceThreshold"] = state?.sdrsFreeSpaceThreshold;
resourceInputs["sdrsFreeSpaceThresholdMode"] = state?.sdrsFreeSpaceThresholdMode;
resourceInputs["sdrsFreeSpaceUtilizationDifference"] = state?.sdrsFreeSpaceUtilizationDifference;
resourceInputs["sdrsIoBalanceAutomationLevel"] = state?.sdrsIoBalanceAutomationLevel;
resourceInputs["sdrsIoLatencyThreshold"] = state?.sdrsIoLatencyThreshold;
resourceInputs["sdrsIoLoadBalanceEnabled"] = state?.sdrsIoLoadBalanceEnabled;
resourceInputs["sdrsIoLoadImbalanceThreshold"] = state?.sdrsIoLoadImbalanceThreshold;
resourceInputs["sdrsIoReservableIopsThreshold"] = state?.sdrsIoReservableIopsThreshold;
resourceInputs["sdrsIoReservablePercentThreshold"] = state?.sdrsIoReservablePercentThreshold;
resourceInputs["sdrsIoReservableThresholdMode"] = state?.sdrsIoReservableThresholdMode;
resourceInputs["sdrsLoadBalanceInterval"] = state?.sdrsLoadBalanceInterval;
resourceInputs["sdrsPolicyEnforcementAutomationLevel"] = state?.sdrsPolicyEnforcementAutomationLevel;
resourceInputs["sdrsRuleEnforcementAutomationLevel"] = state?.sdrsRuleEnforcementAutomationLevel;
resourceInputs["sdrsSpaceBalanceAutomationLevel"] = state?.sdrsSpaceBalanceAutomationLevel;
resourceInputs["sdrsSpaceUtilizationThreshold"] = state?.sdrsSpaceUtilizationThreshold;
resourceInputs["sdrsVmEvacuationAutomationLevel"] = state?.sdrsVmEvacuationAutomationLevel;
resourceInputs["tags"] = state?.tags;
}
else {
const args = argsOrState;
if (args?.datacenterId === undefined && !opts.urn) {
throw new Error("Missing required property 'datacenterId'");
}
resourceInputs["customAttributes"] = args?.customAttributes;
resourceInputs["datacenterId"] = args?.datacenterId;
resourceInputs["folder"] = args?.folder;
resourceInputs["name"] = args?.name;
resourceInputs["sdrsAdvancedOptions"] = args?.sdrsAdvancedOptions;
resourceInputs["sdrsAutomationLevel"] = args?.sdrsAutomationLevel;
resourceInputs["sdrsDefaultIntraVmAffinity"] = args?.sdrsDefaultIntraVmAffinity;
resourceInputs["sdrsEnabled"] = args?.sdrsEnabled;
resourceInputs["sdrsFreeSpaceThreshold"] = args?.sdrsFreeSpaceThreshold;
resourceInputs["sdrsFreeSpaceThresholdMode"] = args?.sdrsFreeSpaceThresholdMode;
resourceInputs["sdrsFreeSpaceUtilizationDifference"] = args?.sdrsFreeSpaceUtilizationDifference;
resourceInputs["sdrsIoBalanceAutomationLevel"] = args?.sdrsIoBalanceAutomationLevel;
resourceInputs["sdrsIoLatencyThreshold"] = args?.sdrsIoLatencyThreshold;
resourceInputs["sdrsIoLoadBalanceEnabled"] = args?.sdrsIoLoadBalanceEnabled;
resourceInputs["sdrsIoLoadImbalanceThreshold"] = args?.sdrsIoLoadImbalanceThreshold;
resourceInputs["sdrsIoReservableIopsThreshold"] = args?.sdrsIoReservableIopsThreshold;
resourceInputs["sdrsIoReservablePercentThreshold"] = args?.sdrsIoReservablePercentThreshold;
resourceInputs["sdrsIoReservableThresholdMode"] = args?.sdrsIoReservableThresholdMode;
resourceInputs["sdrsLoadBalanceInterval"] = args?.sdrsLoadBalanceInterval;
resourceInputs["sdrsPolicyEnforcementAutomationLevel"] = args?.sdrsPolicyEnforcementAutomationLevel;
resourceInputs["sdrsRuleEnforcementAutomationLevel"] = args?.sdrsRuleEnforcementAutomationLevel;
resourceInputs["sdrsSpaceBalanceAutomationLevel"] = args?.sdrsSpaceBalanceAutomationLevel;
resourceInputs["sdrsSpaceUtilizationThreshold"] = args?.sdrsSpaceUtilizationThreshold;
resourceInputs["sdrsVmEvacuationAutomationLevel"] = args?.sdrsVmEvacuationAutomationLevel;
resourceInputs["tags"] = args?.tags;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DatastoreCluster.__pulumiType, name, resourceInputs, opts);
}
}
exports.DatastoreCluster = DatastoreCluster;
/** @internal */
DatastoreCluster.__pulumiType = 'vsphere:index/datastoreCluster:DatastoreCluster';
//# sourceMappingURL=datastoreCluster.js.map