@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
279 lines • 19.4 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.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, Object.assign(Object.assign({}, 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 ? state.customAttributes : undefined;
resourceInputs["datacenterId"] = state ? state.datacenterId : undefined;
resourceInputs["dpmAutomationLevel"] = state ? state.dpmAutomationLevel : undefined;
resourceInputs["dpmEnabled"] = state ? state.dpmEnabled : undefined;
resourceInputs["dpmThreshold"] = state ? state.dpmThreshold : undefined;
resourceInputs["drsAdvancedOptions"] = state ? state.drsAdvancedOptions : undefined;
resourceInputs["drsAutomationLevel"] = state ? state.drsAutomationLevel : undefined;
resourceInputs["drsEnablePredictiveDrs"] = state ? state.drsEnablePredictiveDrs : undefined;
resourceInputs["drsEnableVmOverrides"] = state ? state.drsEnableVmOverrides : undefined;
resourceInputs["drsEnabled"] = state ? state.drsEnabled : undefined;
resourceInputs["drsMigrationThreshold"] = state ? state.drsMigrationThreshold : undefined;
resourceInputs["drsScaleDescendantsShares"] = state ? state.drsScaleDescendantsShares : undefined;
resourceInputs["folder"] = state ? state.folder : undefined;
resourceInputs["forceEvacuateOnDestroy"] = state ? state.forceEvacuateOnDestroy : undefined;
resourceInputs["haAdmissionControlFailoverHostSystemIds"] = state ? state.haAdmissionControlFailoverHostSystemIds : undefined;
resourceInputs["haAdmissionControlHostFailureTolerance"] = state ? state.haAdmissionControlHostFailureTolerance : undefined;
resourceInputs["haAdmissionControlPerformanceTolerance"] = state ? state.haAdmissionControlPerformanceTolerance : undefined;
resourceInputs["haAdmissionControlPolicy"] = state ? state.haAdmissionControlPolicy : undefined;
resourceInputs["haAdmissionControlResourcePercentageAutoCompute"] = state ? state.haAdmissionControlResourcePercentageAutoCompute : undefined;
resourceInputs["haAdmissionControlResourcePercentageCpu"] = state ? state.haAdmissionControlResourcePercentageCpu : undefined;
resourceInputs["haAdmissionControlResourcePercentageMemory"] = state ? state.haAdmissionControlResourcePercentageMemory : undefined;
resourceInputs["haAdmissionControlSlotPolicyExplicitCpu"] = state ? state.haAdmissionControlSlotPolicyExplicitCpu : undefined;
resourceInputs["haAdmissionControlSlotPolicyExplicitMemory"] = state ? state.haAdmissionControlSlotPolicyExplicitMemory : undefined;
resourceInputs["haAdmissionControlSlotPolicyUseExplicitSize"] = state ? state.haAdmissionControlSlotPolicyUseExplicitSize : undefined;
resourceInputs["haAdvancedOptions"] = state ? state.haAdvancedOptions : undefined;
resourceInputs["haDatastoreApdRecoveryAction"] = state ? state.haDatastoreApdRecoveryAction : undefined;
resourceInputs["haDatastoreApdResponse"] = state ? state.haDatastoreApdResponse : undefined;
resourceInputs["haDatastoreApdResponseDelay"] = state ? state.haDatastoreApdResponseDelay : undefined;
resourceInputs["haDatastorePdlResponse"] = state ? state.haDatastorePdlResponse : undefined;
resourceInputs["haEnabled"] = state ? state.haEnabled : undefined;
resourceInputs["haHeartbeatDatastoreIds"] = state ? state.haHeartbeatDatastoreIds : undefined;
resourceInputs["haHeartbeatDatastorePolicy"] = state ? state.haHeartbeatDatastorePolicy : undefined;
resourceInputs["haHostIsolationResponse"] = state ? state.haHostIsolationResponse : undefined;
resourceInputs["haHostMonitoring"] = state ? state.haHostMonitoring : undefined;
resourceInputs["haVmComponentProtection"] = state ? state.haVmComponentProtection : undefined;
resourceInputs["haVmDependencyRestartCondition"] = state ? state.haVmDependencyRestartCondition : undefined;
resourceInputs["haVmFailureInterval"] = state ? state.haVmFailureInterval : undefined;
resourceInputs["haVmMaximumFailureWindow"] = state ? state.haVmMaximumFailureWindow : undefined;
resourceInputs["haVmMaximumResets"] = state ? state.haVmMaximumResets : undefined;
resourceInputs["haVmMinimumUptime"] = state ? state.haVmMinimumUptime : undefined;
resourceInputs["haVmMonitoring"] = state ? state.haVmMonitoring : undefined;
resourceInputs["haVmRestartAdditionalDelay"] = state ? state.haVmRestartAdditionalDelay : undefined;
resourceInputs["haVmRestartPriority"] = state ? state.haVmRestartPriority : undefined;
resourceInputs["haVmRestartTimeout"] = state ? state.haVmRestartTimeout : undefined;
resourceInputs["hostClusterExitTimeout"] = state ? state.hostClusterExitTimeout : undefined;
resourceInputs["hostImage"] = state ? state.hostImage : undefined;
resourceInputs["hostManaged"] = state ? state.hostManaged : undefined;
resourceInputs["hostSystemIds"] = state ? state.hostSystemIds : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["proactiveHaAutomationLevel"] = state ? state.proactiveHaAutomationLevel : undefined;
resourceInputs["proactiveHaEnabled"] = state ? state.proactiveHaEnabled : undefined;
resourceInputs["proactiveHaModerateRemediation"] = state ? state.proactiveHaModerateRemediation : undefined;
resourceInputs["proactiveHaProviderIds"] = state ? state.proactiveHaProviderIds : undefined;
resourceInputs["proactiveHaSevereRemediation"] = state ? state.proactiveHaSevereRemediation : undefined;
resourceInputs["resourcePoolId"] = state ? state.resourcePoolId : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["vsanCompressionEnabled"] = state ? state.vsanCompressionEnabled : undefined;
resourceInputs["vsanDedupEnabled"] = state ? state.vsanDedupEnabled : undefined;
resourceInputs["vsanDiskGroups"] = state ? state.vsanDiskGroups : undefined;
resourceInputs["vsanDitEncryptionEnabled"] = state ? state.vsanDitEncryptionEnabled : undefined;
resourceInputs["vsanDitRekeyInterval"] = state ? state.vsanDitRekeyInterval : undefined;
resourceInputs["vsanEnabled"] = state ? state.vsanEnabled : undefined;
resourceInputs["vsanEsaEnabled"] = state ? state.vsanEsaEnabled : undefined;
resourceInputs["vsanFaultDomains"] = state ? state.vsanFaultDomains : undefined;
resourceInputs["vsanNetworkDiagnosticModeEnabled"] = state ? state.vsanNetworkDiagnosticModeEnabled : undefined;
resourceInputs["vsanPerformanceEnabled"] = state ? state.vsanPerformanceEnabled : undefined;
resourceInputs["vsanRemoteDatastoreIds"] = state ? state.vsanRemoteDatastoreIds : undefined;
resourceInputs["vsanStretchedCluster"] = state ? state.vsanStretchedCluster : undefined;
resourceInputs["vsanUnmapEnabled"] = state ? state.vsanUnmapEnabled : undefined;
resourceInputs["vsanVerboseModeEnabled"] = state ? state.vsanVerboseModeEnabled : 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["dpmAutomationLevel"] = args ? args.dpmAutomationLevel : undefined;
resourceInputs["dpmEnabled"] = args ? args.dpmEnabled : undefined;
resourceInputs["dpmThreshold"] = args ? args.dpmThreshold : undefined;
resourceInputs["drsAdvancedOptions"] = args ? args.drsAdvancedOptions : undefined;
resourceInputs["drsAutomationLevel"] = args ? args.drsAutomationLevel : undefined;
resourceInputs["drsEnablePredictiveDrs"] = args ? args.drsEnablePredictiveDrs : undefined;
resourceInputs["drsEnableVmOverrides"] = args ? args.drsEnableVmOverrides : undefined;
resourceInputs["drsEnabled"] = args ? args.drsEnabled : undefined;
resourceInputs["drsMigrationThreshold"] = args ? args.drsMigrationThreshold : undefined;
resourceInputs["drsScaleDescendantsShares"] = args ? args.drsScaleDescendantsShares : undefined;
resourceInputs["folder"] = args ? args.folder : undefined;
resourceInputs["forceEvacuateOnDestroy"] = args ? args.forceEvacuateOnDestroy : undefined;
resourceInputs["haAdmissionControlFailoverHostSystemIds"] = args ? args.haAdmissionControlFailoverHostSystemIds : undefined;
resourceInputs["haAdmissionControlHostFailureTolerance"] = args ? args.haAdmissionControlHostFailureTolerance : undefined;
resourceInputs["haAdmissionControlPerformanceTolerance"] = args ? args.haAdmissionControlPerformanceTolerance : undefined;
resourceInputs["haAdmissionControlPolicy"] = args ? args.haAdmissionControlPolicy : undefined;
resourceInputs["haAdmissionControlResourcePercentageAutoCompute"] = args ? args.haAdmissionControlResourcePercentageAutoCompute : undefined;
resourceInputs["haAdmissionControlResourcePercentageCpu"] = args ? args.haAdmissionControlResourcePercentageCpu : undefined;
resourceInputs["haAdmissionControlResourcePercentageMemory"] = args ? args.haAdmissionControlResourcePercentageMemory : undefined;
resourceInputs["haAdmissionControlSlotPolicyExplicitCpu"] = args ? args.haAdmissionControlSlotPolicyExplicitCpu : undefined;
resourceInputs["haAdmissionControlSlotPolicyExplicitMemory"] = args ? args.haAdmissionControlSlotPolicyExplicitMemory : undefined;
resourceInputs["haAdmissionControlSlotPolicyUseExplicitSize"] = args ? args.haAdmissionControlSlotPolicyUseExplicitSize : undefined;
resourceInputs["haAdvancedOptions"] = args ? args.haAdvancedOptions : undefined;
resourceInputs["haDatastoreApdRecoveryAction"] = args ? args.haDatastoreApdRecoveryAction : undefined;
resourceInputs["haDatastoreApdResponse"] = args ? args.haDatastoreApdResponse : undefined;
resourceInputs["haDatastoreApdResponseDelay"] = args ? args.haDatastoreApdResponseDelay : undefined;
resourceInputs["haDatastorePdlResponse"] = args ? args.haDatastorePdlResponse : undefined;
resourceInputs["haEnabled"] = args ? args.haEnabled : undefined;
resourceInputs["haHeartbeatDatastoreIds"] = args ? args.haHeartbeatDatastoreIds : undefined;
resourceInputs["haHeartbeatDatastorePolicy"] = args ? args.haHeartbeatDatastorePolicy : undefined;
resourceInputs["haHostIsolationResponse"] = args ? args.haHostIsolationResponse : undefined;
resourceInputs["haHostMonitoring"] = args ? args.haHostMonitoring : undefined;
resourceInputs["haVmComponentProtection"] = args ? args.haVmComponentProtection : undefined;
resourceInputs["haVmDependencyRestartCondition"] = args ? args.haVmDependencyRestartCondition : undefined;
resourceInputs["haVmFailureInterval"] = args ? args.haVmFailureInterval : undefined;
resourceInputs["haVmMaximumFailureWindow"] = args ? args.haVmMaximumFailureWindow : undefined;
resourceInputs["haVmMaximumResets"] = args ? args.haVmMaximumResets : undefined;
resourceInputs["haVmMinimumUptime"] = args ? args.haVmMinimumUptime : undefined;
resourceInputs["haVmMonitoring"] = args ? args.haVmMonitoring : undefined;
resourceInputs["haVmRestartAdditionalDelay"] = args ? args.haVmRestartAdditionalDelay : undefined;
resourceInputs["haVmRestartPriority"] = args ? args.haVmRestartPriority : undefined;
resourceInputs["haVmRestartTimeout"] = args ? args.haVmRestartTimeout : undefined;
resourceInputs["hostClusterExitTimeout"] = args ? args.hostClusterExitTimeout : undefined;
resourceInputs["hostImage"] = args ? args.hostImage : undefined;
resourceInputs["hostManaged"] = args ? args.hostManaged : undefined;
resourceInputs["hostSystemIds"] = args ? args.hostSystemIds : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["proactiveHaAutomationLevel"] = args ? args.proactiveHaAutomationLevel : undefined;
resourceInputs["proactiveHaEnabled"] = args ? args.proactiveHaEnabled : undefined;
resourceInputs["proactiveHaModerateRemediation"] = args ? args.proactiveHaModerateRemediation : undefined;
resourceInputs["proactiveHaProviderIds"] = args ? args.proactiveHaProviderIds : undefined;
resourceInputs["proactiveHaSevereRemediation"] = args ? args.proactiveHaSevereRemediation : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["vsanCompressionEnabled"] = args ? args.vsanCompressionEnabled : undefined;
resourceInputs["vsanDedupEnabled"] = args ? args.vsanDedupEnabled : undefined;
resourceInputs["vsanDiskGroups"] = args ? args.vsanDiskGroups : undefined;
resourceInputs["vsanDitEncryptionEnabled"] = args ? args.vsanDitEncryptionEnabled : undefined;
resourceInputs["vsanDitRekeyInterval"] = args ? args.vsanDitRekeyInterval : undefined;
resourceInputs["vsanEnabled"] = args ? args.vsanEnabled : undefined;
resourceInputs["vsanEsaEnabled"] = args ? args.vsanEsaEnabled : undefined;
resourceInputs["vsanFaultDomains"] = args ? args.vsanFaultDomains : undefined;
resourceInputs["vsanNetworkDiagnosticModeEnabled"] = args ? args.vsanNetworkDiagnosticModeEnabled : undefined;
resourceInputs["vsanPerformanceEnabled"] = args ? args.vsanPerformanceEnabled : undefined;
resourceInputs["vsanRemoteDatastoreIds"] = args ? args.vsanRemoteDatastoreIds : undefined;
resourceInputs["vsanStretchedCluster"] = args ? args.vsanStretchedCluster : undefined;
resourceInputs["vsanUnmapEnabled"] = args ? args.vsanUnmapEnabled : undefined;
resourceInputs["vsanVerboseModeEnabled"] = args ? args.vsanVerboseModeEnabled : undefined;
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