@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
177 lines • 10.3 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.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, Object.assign(Object.assign({}, 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 ? state.customAttributes : undefined;
resourceInputs["datacenterId"] = state ? state.datacenterId : undefined;
resourceInputs["folder"] = state ? state.folder : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["sdrsAdvancedOptions"] = state ? state.sdrsAdvancedOptions : undefined;
resourceInputs["sdrsAutomationLevel"] = state ? state.sdrsAutomationLevel : undefined;
resourceInputs["sdrsDefaultIntraVmAffinity"] = state ? state.sdrsDefaultIntraVmAffinity : undefined;
resourceInputs["sdrsEnabled"] = state ? state.sdrsEnabled : undefined;
resourceInputs["sdrsFreeSpaceThreshold"] = state ? state.sdrsFreeSpaceThreshold : undefined;
resourceInputs["sdrsFreeSpaceThresholdMode"] = state ? state.sdrsFreeSpaceThresholdMode : undefined;
resourceInputs["sdrsFreeSpaceUtilizationDifference"] = state ? state.sdrsFreeSpaceUtilizationDifference : undefined;
resourceInputs["sdrsIoBalanceAutomationLevel"] = state ? state.sdrsIoBalanceAutomationLevel : undefined;
resourceInputs["sdrsIoLatencyThreshold"] = state ? state.sdrsIoLatencyThreshold : undefined;
resourceInputs["sdrsIoLoadBalanceEnabled"] = state ? state.sdrsIoLoadBalanceEnabled : undefined;
resourceInputs["sdrsIoLoadImbalanceThreshold"] = state ? state.sdrsIoLoadImbalanceThreshold : undefined;
resourceInputs["sdrsIoReservableIopsThreshold"] = state ? state.sdrsIoReservableIopsThreshold : undefined;
resourceInputs["sdrsIoReservablePercentThreshold"] = state ? state.sdrsIoReservablePercentThreshold : undefined;
resourceInputs["sdrsIoReservableThresholdMode"] = state ? state.sdrsIoReservableThresholdMode : undefined;
resourceInputs["sdrsLoadBalanceInterval"] = state ? state.sdrsLoadBalanceInterval : undefined;
resourceInputs["sdrsPolicyEnforcementAutomationLevel"] = state ? state.sdrsPolicyEnforcementAutomationLevel : undefined;
resourceInputs["sdrsRuleEnforcementAutomationLevel"] = state ? state.sdrsRuleEnforcementAutomationLevel : undefined;
resourceInputs["sdrsSpaceBalanceAutomationLevel"] = state ? state.sdrsSpaceBalanceAutomationLevel : undefined;
resourceInputs["sdrsSpaceUtilizationThreshold"] = state ? state.sdrsSpaceUtilizationThreshold : undefined;
resourceInputs["sdrsVmEvacuationAutomationLevel"] = state ? state.sdrsVmEvacuationAutomationLevel : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
}
else {
const args = argsOrState;
if ((!args || args.datacenterId === undefined) && !opts.urn) {
throw new Error("Missing required property 'datacenterId'");
}
resourceInputs["customAttributes"] = args ? args.customAttributes : undefined;
resourceInputs["datacenterId"] = args ? args.datacenterId : undefined;
resourceInputs["folder"] = args ? args.folder : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["sdrsAdvancedOptions"] = args ? args.sdrsAdvancedOptions : undefined;
resourceInputs["sdrsAutomationLevel"] = args ? args.sdrsAutomationLevel : undefined;
resourceInputs["sdrsDefaultIntraVmAffinity"] = args ? args.sdrsDefaultIntraVmAffinity : undefined;
resourceInputs["sdrsEnabled"] = args ? args.sdrsEnabled : undefined;
resourceInputs["sdrsFreeSpaceThreshold"] = args ? args.sdrsFreeSpaceThreshold : undefined;
resourceInputs["sdrsFreeSpaceThresholdMode"] = args ? args.sdrsFreeSpaceThresholdMode : undefined;
resourceInputs["sdrsFreeSpaceUtilizationDifference"] = args ? args.sdrsFreeSpaceUtilizationDifference : undefined;
resourceInputs["sdrsIoBalanceAutomationLevel"] = args ? args.sdrsIoBalanceAutomationLevel : undefined;
resourceInputs["sdrsIoLatencyThreshold"] = args ? args.sdrsIoLatencyThreshold : undefined;
resourceInputs["sdrsIoLoadBalanceEnabled"] = args ? args.sdrsIoLoadBalanceEnabled : undefined;
resourceInputs["sdrsIoLoadImbalanceThreshold"] = args ? args.sdrsIoLoadImbalanceThreshold : undefined;
resourceInputs["sdrsIoReservableIopsThreshold"] = args ? args.sdrsIoReservableIopsThreshold : undefined;
resourceInputs["sdrsIoReservablePercentThreshold"] = args ? args.sdrsIoReservablePercentThreshold : undefined;
resourceInputs["sdrsIoReservableThresholdMode"] = args ? args.sdrsIoReservableThresholdMode : undefined;
resourceInputs["sdrsLoadBalanceInterval"] = args ? args.sdrsLoadBalanceInterval : undefined;
resourceInputs["sdrsPolicyEnforcementAutomationLevel"] = args ? args.sdrsPolicyEnforcementAutomationLevel : undefined;
resourceInputs["sdrsRuleEnforcementAutomationLevel"] = args ? args.sdrsRuleEnforcementAutomationLevel : undefined;
resourceInputs["sdrsSpaceBalanceAutomationLevel"] = args ? args.sdrsSpaceBalanceAutomationLevel : undefined;
resourceInputs["sdrsSpaceUtilizationThreshold"] = args ? args.sdrsSpaceUtilizationThreshold : undefined;
resourceInputs["sdrsVmEvacuationAutomationLevel"] = args ? args.sdrsVmEvacuationAutomationLevel : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
}
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