@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
279 lines • 16.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.ComputeCluster = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* > **A note on the naming of this resource:** VMware refers to clusters of
* hosts in the UI and documentation as _clusters_, _HA clusters_, or _DRS
* clusters_. All of these refer to the same kind of resource (with the latter two
* referring to specific features of clustering). We use
* `vsphere.ComputeCluster` to differentiate host clusters from _datastore
* clusters_, which are clusters of datastores that can be used to distribute load
* and ensure fault tolerance via distribution of virtual machines. Datastore
* clusters can also be managed through the provider, via the
* `vsphere.DatastoreCluster` resource.
*
* The `vsphere.ComputeCluster` resource can be used to create and manage
* clusters of hosts allowing for resource control of compute resources, load
* balancing through DRS, and high availability through vSphere HA.
*
* For more information on vSphere clusters and DRS, see [this
* page][ref-vsphere-drs-clusters]. For more information on vSphere HA, see [this
* page][ref-vsphere-ha-clusters].
*
* [ref-vsphere-drs-clusters]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-resource-management-8-0/creating-a-drs-cluster.html
* [ref-vsphere-ha-clusters]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-availability.html
*
* > **NOTE:** This resource requires vCenter and is not available on
* direct ESXi connections.
*
* ## Import
*
* An existing 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
*
* hcl
*
* variable "datacenter" {
*
* default = "dc-01"
*
* }
*
* data "vsphere_datacenter" "datacenter" {
*
* name = var.datacenter
*
* }
*
* resource "vsphere_compute_cluster" "compute_cluster" {
*
* name = "cluster-01"
*
* datacenter_id = data.vsphere_datacenter.datacenter.id
*
* }
*
* hcl
*
* resource "vsphere_compute_cluster" "compute_cluster" {
*
* name = "cluster-01"
*
* datacenter_id = data.vsphere_datacenter.datacenter.id
*
* vsan_enabled = true
*
* vsan_performance_enabled = true
*
* host_system_ids = [for host in data.vsphere_host.host : host.id]
*
* dpm_automation_level = "automated"
*
* drs_automation_level = "fullyAutomated"
*
* drs_enabled = true
*
* ha_datastore_apd_response = "restartConservative"
*
* ha_datastore_pdl_response = "restartAggressive"
*
* }
*
* ```sh
* $ pulumi import vsphere:index/computeCluster:ComputeCluster compute_cluster /dc-01/host/cluster-01
* ```
*
* The above would import the cluster named `cluster-01` that is located in
*
* the `dc-01` datacenter.
*/
class ComputeCluster extends pulumi.CustomResource {
/**
* Get an existing ComputeCluster 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 ComputeCluster(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of ComputeCluster. 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'] === ComputeCluster.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["customAttributes"] = state?.customAttributes;
resourceInputs["datacenterId"] = state?.datacenterId;
resourceInputs["dpmAutomationLevel"] = state?.dpmAutomationLevel;
resourceInputs["dpmEnabled"] = state?.dpmEnabled;
resourceInputs["dpmThreshold"] = state?.dpmThreshold;
resourceInputs["drsAdvancedOptions"] = state?.drsAdvancedOptions;
resourceInputs["drsAutomationLevel"] = state?.drsAutomationLevel;
resourceInputs["drsEnablePredictiveDrs"] = state?.drsEnablePredictiveDrs;
resourceInputs["drsEnableVmOverrides"] = state?.drsEnableVmOverrides;
resourceInputs["drsEnabled"] = state?.drsEnabled;
resourceInputs["drsMigrationThreshold"] = state?.drsMigrationThreshold;
resourceInputs["drsScaleDescendantsShares"] = state?.drsScaleDescendantsShares;
resourceInputs["folder"] = state?.folder;
resourceInputs["forceEvacuateOnDestroy"] = state?.forceEvacuateOnDestroy;
resourceInputs["haAdmissionControlFailoverHostSystemIds"] = state?.haAdmissionControlFailoverHostSystemIds;
resourceInputs["haAdmissionControlHostFailureTolerance"] = state?.haAdmissionControlHostFailureTolerance;
resourceInputs["haAdmissionControlPerformanceTolerance"] = state?.haAdmissionControlPerformanceTolerance;
resourceInputs["haAdmissionControlPolicy"] = state?.haAdmissionControlPolicy;
resourceInputs["haAdmissionControlResourcePercentageAutoCompute"] = state?.haAdmissionControlResourcePercentageAutoCompute;
resourceInputs["haAdmissionControlResourcePercentageCpu"] = state?.haAdmissionControlResourcePercentageCpu;
resourceInputs["haAdmissionControlResourcePercentageMemory"] = state?.haAdmissionControlResourcePercentageMemory;
resourceInputs["haAdmissionControlSlotPolicyExplicitCpu"] = state?.haAdmissionControlSlotPolicyExplicitCpu;
resourceInputs["haAdmissionControlSlotPolicyExplicitMemory"] = state?.haAdmissionControlSlotPolicyExplicitMemory;
resourceInputs["haAdmissionControlSlotPolicyUseExplicitSize"] = state?.haAdmissionControlSlotPolicyUseExplicitSize;
resourceInputs["haAdvancedOptions"] = state?.haAdvancedOptions;
resourceInputs["haDatastoreApdRecoveryAction"] = state?.haDatastoreApdRecoveryAction;
resourceInputs["haDatastoreApdResponse"] = state?.haDatastoreApdResponse;
resourceInputs["haDatastoreApdResponseDelay"] = state?.haDatastoreApdResponseDelay;
resourceInputs["haDatastorePdlResponse"] = state?.haDatastorePdlResponse;
resourceInputs["haEnabled"] = state?.haEnabled;
resourceInputs["haHeartbeatDatastoreIds"] = state?.haHeartbeatDatastoreIds;
resourceInputs["haHeartbeatDatastorePolicy"] = state?.haHeartbeatDatastorePolicy;
resourceInputs["haHostIsolationResponse"] = state?.haHostIsolationResponse;
resourceInputs["haHostMonitoring"] = state?.haHostMonitoring;
resourceInputs["haVmComponentProtection"] = state?.haVmComponentProtection;
resourceInputs["haVmDependencyRestartCondition"] = state?.haVmDependencyRestartCondition;
resourceInputs["haVmFailureInterval"] = state?.haVmFailureInterval;
resourceInputs["haVmMaximumFailureWindow"] = state?.haVmMaximumFailureWindow;
resourceInputs["haVmMaximumResets"] = state?.haVmMaximumResets;
resourceInputs["haVmMinimumUptime"] = state?.haVmMinimumUptime;
resourceInputs["haVmMonitoring"] = state?.haVmMonitoring;
resourceInputs["haVmRestartAdditionalDelay"] = state?.haVmRestartAdditionalDelay;
resourceInputs["haVmRestartPriority"] = state?.haVmRestartPriority;
resourceInputs["haVmRestartTimeout"] = state?.haVmRestartTimeout;
resourceInputs["hostClusterExitTimeout"] = state?.hostClusterExitTimeout;
resourceInputs["hostImage"] = state?.hostImage;
resourceInputs["hostManaged"] = state?.hostManaged;
resourceInputs["hostSystemIds"] = state?.hostSystemIds;
resourceInputs["name"] = state?.name;
resourceInputs["proactiveHaAutomationLevel"] = state?.proactiveHaAutomationLevel;
resourceInputs["proactiveHaEnabled"] = state?.proactiveHaEnabled;
resourceInputs["proactiveHaModerateRemediation"] = state?.proactiveHaModerateRemediation;
resourceInputs["proactiveHaProviderIds"] = state?.proactiveHaProviderIds;
resourceInputs["proactiveHaSevereRemediation"] = state?.proactiveHaSevereRemediation;
resourceInputs["resourcePoolId"] = state?.resourcePoolId;
resourceInputs["tags"] = state?.tags;
resourceInputs["vsanCompressionEnabled"] = state?.vsanCompressionEnabled;
resourceInputs["vsanDedupEnabled"] = state?.vsanDedupEnabled;
resourceInputs["vsanDiskGroups"] = state?.vsanDiskGroups;
resourceInputs["vsanDitEncryptionEnabled"] = state?.vsanDitEncryptionEnabled;
resourceInputs["vsanDitRekeyInterval"] = state?.vsanDitRekeyInterval;
resourceInputs["vsanEnabled"] = state?.vsanEnabled;
resourceInputs["vsanEsaEnabled"] = state?.vsanEsaEnabled;
resourceInputs["vsanFaultDomains"] = state?.vsanFaultDomains;
resourceInputs["vsanNetworkDiagnosticModeEnabled"] = state?.vsanNetworkDiagnosticModeEnabled;
resourceInputs["vsanPerformanceEnabled"] = state?.vsanPerformanceEnabled;
resourceInputs["vsanRemoteDatastoreIds"] = state?.vsanRemoteDatastoreIds;
resourceInputs["vsanStretchedCluster"] = state?.vsanStretchedCluster;
resourceInputs["vsanUnmapEnabled"] = state?.vsanUnmapEnabled;
resourceInputs["vsanVerboseModeEnabled"] = state?.vsanVerboseModeEnabled;
}
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["dpmAutomationLevel"] = args?.dpmAutomationLevel;
resourceInputs["dpmEnabled"] = args?.dpmEnabled;
resourceInputs["dpmThreshold"] = args?.dpmThreshold;
resourceInputs["drsAdvancedOptions"] = args?.drsAdvancedOptions;
resourceInputs["drsAutomationLevel"] = args?.drsAutomationLevel;
resourceInputs["drsEnablePredictiveDrs"] = args?.drsEnablePredictiveDrs;
resourceInputs["drsEnableVmOverrides"] = args?.drsEnableVmOverrides;
resourceInputs["drsEnabled"] = args?.drsEnabled;
resourceInputs["drsMigrationThreshold"] = args?.drsMigrationThreshold;
resourceInputs["drsScaleDescendantsShares"] = args?.drsScaleDescendantsShares;
resourceInputs["folder"] = args?.folder;
resourceInputs["forceEvacuateOnDestroy"] = args?.forceEvacuateOnDestroy;
resourceInputs["haAdmissionControlFailoverHostSystemIds"] = args?.haAdmissionControlFailoverHostSystemIds;
resourceInputs["haAdmissionControlHostFailureTolerance"] = args?.haAdmissionControlHostFailureTolerance;
resourceInputs["haAdmissionControlPerformanceTolerance"] = args?.haAdmissionControlPerformanceTolerance;
resourceInputs["haAdmissionControlPolicy"] = args?.haAdmissionControlPolicy;
resourceInputs["haAdmissionControlResourcePercentageAutoCompute"] = args?.haAdmissionControlResourcePercentageAutoCompute;
resourceInputs["haAdmissionControlResourcePercentageCpu"] = args?.haAdmissionControlResourcePercentageCpu;
resourceInputs["haAdmissionControlResourcePercentageMemory"] = args?.haAdmissionControlResourcePercentageMemory;
resourceInputs["haAdmissionControlSlotPolicyExplicitCpu"] = args?.haAdmissionControlSlotPolicyExplicitCpu;
resourceInputs["haAdmissionControlSlotPolicyExplicitMemory"] = args?.haAdmissionControlSlotPolicyExplicitMemory;
resourceInputs["haAdmissionControlSlotPolicyUseExplicitSize"] = args?.haAdmissionControlSlotPolicyUseExplicitSize;
resourceInputs["haAdvancedOptions"] = args?.haAdvancedOptions;
resourceInputs["haDatastoreApdRecoveryAction"] = args?.haDatastoreApdRecoveryAction;
resourceInputs["haDatastoreApdResponse"] = args?.haDatastoreApdResponse;
resourceInputs["haDatastoreApdResponseDelay"] = args?.haDatastoreApdResponseDelay;
resourceInputs["haDatastorePdlResponse"] = args?.haDatastorePdlResponse;
resourceInputs["haEnabled"] = args?.haEnabled;
resourceInputs["haHeartbeatDatastoreIds"] = args?.haHeartbeatDatastoreIds;
resourceInputs["haHeartbeatDatastorePolicy"] = args?.haHeartbeatDatastorePolicy;
resourceInputs["haHostIsolationResponse"] = args?.haHostIsolationResponse;
resourceInputs["haHostMonitoring"] = args?.haHostMonitoring;
resourceInputs["haVmComponentProtection"] = args?.haVmComponentProtection;
resourceInputs["haVmDependencyRestartCondition"] = args?.haVmDependencyRestartCondition;
resourceInputs["haVmFailureInterval"] = args?.haVmFailureInterval;
resourceInputs["haVmMaximumFailureWindow"] = args?.haVmMaximumFailureWindow;
resourceInputs["haVmMaximumResets"] = args?.haVmMaximumResets;
resourceInputs["haVmMinimumUptime"] = args?.haVmMinimumUptime;
resourceInputs["haVmMonitoring"] = args?.haVmMonitoring;
resourceInputs["haVmRestartAdditionalDelay"] = args?.haVmRestartAdditionalDelay;
resourceInputs["haVmRestartPriority"] = args?.haVmRestartPriority;
resourceInputs["haVmRestartTimeout"] = args?.haVmRestartTimeout;
resourceInputs["hostClusterExitTimeout"] = args?.hostClusterExitTimeout;
resourceInputs["hostImage"] = args?.hostImage;
resourceInputs["hostManaged"] = args?.hostManaged;
resourceInputs["hostSystemIds"] = args?.hostSystemIds;
resourceInputs["name"] = args?.name;
resourceInputs["proactiveHaAutomationLevel"] = args?.proactiveHaAutomationLevel;
resourceInputs["proactiveHaEnabled"] = args?.proactiveHaEnabled;
resourceInputs["proactiveHaModerateRemediation"] = args?.proactiveHaModerateRemediation;
resourceInputs["proactiveHaProviderIds"] = args?.proactiveHaProviderIds;
resourceInputs["proactiveHaSevereRemediation"] = args?.proactiveHaSevereRemediation;
resourceInputs["tags"] = args?.tags;
resourceInputs["vsanCompressionEnabled"] = args?.vsanCompressionEnabled;
resourceInputs["vsanDedupEnabled"] = args?.vsanDedupEnabled;
resourceInputs["vsanDiskGroups"] = args?.vsanDiskGroups;
resourceInputs["vsanDitEncryptionEnabled"] = args?.vsanDitEncryptionEnabled;
resourceInputs["vsanDitRekeyInterval"] = args?.vsanDitRekeyInterval;
resourceInputs["vsanEnabled"] = args?.vsanEnabled;
resourceInputs["vsanEsaEnabled"] = args?.vsanEsaEnabled;
resourceInputs["vsanFaultDomains"] = args?.vsanFaultDomains;
resourceInputs["vsanNetworkDiagnosticModeEnabled"] = args?.vsanNetworkDiagnosticModeEnabled;
resourceInputs["vsanPerformanceEnabled"] = args?.vsanPerformanceEnabled;
resourceInputs["vsanRemoteDatastoreIds"] = args?.vsanRemoteDatastoreIds;
resourceInputs["vsanStretchedCluster"] = args?.vsanStretchedCluster;
resourceInputs["vsanUnmapEnabled"] = args?.vsanUnmapEnabled;
resourceInputs["vsanVerboseModeEnabled"] = args?.vsanVerboseModeEnabled;
resourceInputs["resourcePoolId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ComputeCluster.__pulumiType, name, resourceInputs, opts);
}
}
exports.ComputeCluster = ComputeCluster;
/** @internal */
ComputeCluster.__pulumiType = 'vsphere:index/computeCluster:ComputeCluster';
//# sourceMappingURL=computeCluster.js.map