UNPKG

@pulumi/vsphere

Version:

A Pulumi package for creating vsphere resources

373 lines • 24.9 kB
"use strict"; // *** 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.DistributedVirtualSwitch = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * The `vsphere.DistributedVirtualSwitch` resource can be used to manage vSphere * Distributed Switches (VDS). * * An essential component of a distributed, scalable vSphere infrastructure, the * VDS provides centralized management and monitoring of the networking * configuration for all the hosts that are associated with the switch. * In addition to adding distributed port groups * (see the `vsphere.DistributedPortGroup` resource) * that can be used as networks for virtual machines, a VDS can be configured to * perform advanced high availability, traffic shaping, network monitoring, etc. * * For an overview on vSphere networking concepts, see * [this page][ref-vsphere-net-concepts]. * * For more information on the VDS, see [this page][ref-vsphere-vds]. * * [ref-vsphere-net-concepts]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-networking-8-0/basic-networking-with-vnetwork-distributed-switches/dvport-groups.html * [ref-vsphere-vds]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-networking-8-0/basic-networking-with-vnetwork-distributed-switches.html * * > **NOTE:** This resource requires vCenter and is not available on * direct ESXi host connections. * * ## Example Usage * * The following example below demonstrates a "standard" example of configuring a * VDS in a 3-node vSphere datacenter named `dc1`, across 4 NICs with two being * used as active, and two being used as passive. Note that the NIC failover order * propagates to any port groups configured on this VDS and can be overridden. * * ```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 networkInterfaces = config.getObject<any>("networkInterfaces") || [ * "vmnic0", * "vmnic1", * "vmnic2", * "vmnic3", * ]; * const datacenter = vsphere.getDatacenter({ * name: "dc-01", * }); * const host = (new Array(hosts.length)).map((_, i) => i).map(__index => (vsphere.getHost({ * name: hosts[__index], * datacenterId: _arg0_.id, * }))); * const vds = new vsphere.DistributedVirtualSwitch("vds", { * name: "vds-01", * datacenterId: datacenter.then(datacenter => datacenter.id), * uplinks: [ * "uplink1", * "uplink2", * "uplink3", * "uplink4", * ], * activeUplinks: [ * "uplink1", * "uplink2", * ], * standbyUplinks: [ * "uplink3", * "uplink4", * ], * hosts: [ * { * hostSystemId: host[0].then(host => host.id), * devices: [networkInterfaces], * }, * { * hostSystemId: host[1].then(host => host.id), * devices: [networkInterfaces], * }, * { * hostSystemId: host[2].then(host => host.id), * devices: [networkInterfaces], * }, * ], * }); * ``` * * ### Uplink name and count control * * The following abridged example below demonstrates how you can manage the number * of uplinks, and the name of the uplinks via the `uplinks` parameter. * * Note that if you change the uplink naming and count after creating the VDS, you * may need to explicitly specify `activeUplinks` and `standbyUplinks` as these * values are saved to state after creation, regardless of being * specified in config, and will drift if not modified, causing errors. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as vsphere from "@pulumi/vsphere"; * * const vds = new vsphere.DistributedVirtualSwitch("vds", { * name: "vds-01", * datacenterId: datacenter.id, * uplinks: [ * "uplink1", * "uplink2", * ], * activeUplinks: ["uplink1"], * standbyUplinks: ["uplink2"], * }); * ``` * * > **NOTE:** The default uplink names when a VDS is created are `uplink1` * through to `uplink4`, however this default is not guaranteed to be stable and * you are encouraged to set your own. * * ## Import * * An existing VDS can be imported into this resource via the path * * to the VDS, via the following command: * * [docs-import]: https://developer.hashicorp.com/terraform/cli/import * * ```sh * $ pulumi import vsphere:index/distributedVirtualSwitch:DistributedVirtualSwitch vds /dc-01/network/vds-01 * ``` * * The above would import the VDS named `vds-01` that is located in the `dc-01` * * datacenter. */ class DistributedVirtualSwitch extends pulumi.CustomResource { /** * Get an existing DistributedVirtualSwitch 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 DistributedVirtualSwitch(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of DistributedVirtualSwitch. 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'] === DistributedVirtualSwitch.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["activeUplinks"] = state ? state.activeUplinks : undefined; resourceInputs["allowForgedTransmits"] = state ? state.allowForgedTransmits : undefined; resourceInputs["allowMacChanges"] = state ? state.allowMacChanges : undefined; resourceInputs["allowPromiscuous"] = state ? state.allowPromiscuous : undefined; resourceInputs["backupnfcMaximumMbit"] = state ? state.backupnfcMaximumMbit : undefined; resourceInputs["backupnfcReservationMbit"] = state ? state.backupnfcReservationMbit : undefined; resourceInputs["backupnfcShareCount"] = state ? state.backupnfcShareCount : undefined; resourceInputs["backupnfcShareLevel"] = state ? state.backupnfcShareLevel : undefined; resourceInputs["blockAllPorts"] = state ? state.blockAllPorts : undefined; resourceInputs["checkBeacon"] = state ? state.checkBeacon : undefined; resourceInputs["configVersion"] = state ? state.configVersion : undefined; resourceInputs["contactDetail"] = state ? state.contactDetail : undefined; resourceInputs["contactName"] = state ? state.contactName : undefined; resourceInputs["customAttributes"] = state ? state.customAttributes : undefined; resourceInputs["datacenterId"] = state ? state.datacenterId : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["directpathGen2Allowed"] = state ? state.directpathGen2Allowed : undefined; resourceInputs["egressShapingAverageBandwidth"] = state ? state.egressShapingAverageBandwidth : undefined; resourceInputs["egressShapingBurstSize"] = state ? state.egressShapingBurstSize : undefined; resourceInputs["egressShapingEnabled"] = state ? state.egressShapingEnabled : undefined; resourceInputs["egressShapingPeakBandwidth"] = state ? state.egressShapingPeakBandwidth : undefined; resourceInputs["failback"] = state ? state.failback : undefined; resourceInputs["faulttoleranceMaximumMbit"] = state ? state.faulttoleranceMaximumMbit : undefined; resourceInputs["faulttoleranceReservationMbit"] = state ? state.faulttoleranceReservationMbit : undefined; resourceInputs["faulttoleranceShareCount"] = state ? state.faulttoleranceShareCount : undefined; resourceInputs["faulttoleranceShareLevel"] = state ? state.faulttoleranceShareLevel : undefined; resourceInputs["folder"] = state ? state.folder : undefined; resourceInputs["hbrMaximumMbit"] = state ? state.hbrMaximumMbit : undefined; resourceInputs["hbrReservationMbit"] = state ? state.hbrReservationMbit : undefined; resourceInputs["hbrShareCount"] = state ? state.hbrShareCount : undefined; resourceInputs["hbrShareLevel"] = state ? state.hbrShareLevel : undefined; resourceInputs["hosts"] = state ? state.hosts : undefined; resourceInputs["ignoreOtherPvlanMappings"] = state ? state.ignoreOtherPvlanMappings : undefined; resourceInputs["ingressShapingAverageBandwidth"] = state ? state.ingressShapingAverageBandwidth : undefined; resourceInputs["ingressShapingBurstSize"] = state ? state.ingressShapingBurstSize : undefined; resourceInputs["ingressShapingEnabled"] = state ? state.ingressShapingEnabled : undefined; resourceInputs["ingressShapingPeakBandwidth"] = state ? state.ingressShapingPeakBandwidth : undefined; resourceInputs["ipv4Address"] = state ? state.ipv4Address : undefined; resourceInputs["iscsiMaximumMbit"] = state ? state.iscsiMaximumMbit : undefined; resourceInputs["iscsiReservationMbit"] = state ? state.iscsiReservationMbit : undefined; resourceInputs["iscsiShareCount"] = state ? state.iscsiShareCount : undefined; resourceInputs["iscsiShareLevel"] = state ? state.iscsiShareLevel : undefined; resourceInputs["lacpApiVersion"] = state ? state.lacpApiVersion : undefined; resourceInputs["lacpEnabled"] = state ? state.lacpEnabled : undefined; resourceInputs["lacpMode"] = state ? state.lacpMode : undefined; resourceInputs["linkDiscoveryOperation"] = state ? state.linkDiscoveryOperation : undefined; resourceInputs["linkDiscoveryProtocol"] = state ? state.linkDiscoveryProtocol : undefined; resourceInputs["managementMaximumMbit"] = state ? state.managementMaximumMbit : undefined; resourceInputs["managementReservationMbit"] = state ? state.managementReservationMbit : undefined; resourceInputs["managementShareCount"] = state ? state.managementShareCount : undefined; resourceInputs["managementShareLevel"] = state ? state.managementShareLevel : undefined; resourceInputs["maxMtu"] = state ? state.maxMtu : undefined; resourceInputs["multicastFilteringMode"] = state ? state.multicastFilteringMode : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["netflowActiveFlowTimeout"] = state ? state.netflowActiveFlowTimeout : undefined; resourceInputs["netflowCollectorIpAddress"] = state ? state.netflowCollectorIpAddress : undefined; resourceInputs["netflowCollectorPort"] = state ? state.netflowCollectorPort : undefined; resourceInputs["netflowEnabled"] = state ? state.netflowEnabled : undefined; resourceInputs["netflowIdleFlowTimeout"] = state ? state.netflowIdleFlowTimeout : undefined; resourceInputs["netflowInternalFlowsOnly"] = state ? state.netflowInternalFlowsOnly : undefined; resourceInputs["netflowObservationDomainId"] = state ? state.netflowObservationDomainId : undefined; resourceInputs["netflowSamplingRate"] = state ? state.netflowSamplingRate : undefined; resourceInputs["networkResourceControlEnabled"] = state ? state.networkResourceControlEnabled : undefined; resourceInputs["networkResourceControlVersion"] = state ? state.networkResourceControlVersion : undefined; resourceInputs["nfsMaximumMbit"] = state ? state.nfsMaximumMbit : undefined; resourceInputs["nfsReservationMbit"] = state ? state.nfsReservationMbit : undefined; resourceInputs["nfsShareCount"] = state ? state.nfsShareCount : undefined; resourceInputs["nfsShareLevel"] = state ? state.nfsShareLevel : undefined; resourceInputs["notifySwitches"] = state ? state.notifySwitches : undefined; resourceInputs["portPrivateSecondaryVlanId"] = state ? state.portPrivateSecondaryVlanId : undefined; resourceInputs["pvlanMappings"] = state ? state.pvlanMappings : undefined; resourceInputs["standbyUplinks"] = state ? state.standbyUplinks : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["teamingPolicy"] = state ? state.teamingPolicy : undefined; resourceInputs["txUplink"] = state ? state.txUplink : undefined; resourceInputs["uplinks"] = state ? state.uplinks : undefined; resourceInputs["vdpMaximumMbit"] = state ? state.vdpMaximumMbit : undefined; resourceInputs["vdpReservationMbit"] = state ? state.vdpReservationMbit : undefined; resourceInputs["vdpShareCount"] = state ? state.vdpShareCount : undefined; resourceInputs["vdpShareLevel"] = state ? state.vdpShareLevel : undefined; resourceInputs["version"] = state ? state.version : undefined; resourceInputs["virtualmachineMaximumMbit"] = state ? state.virtualmachineMaximumMbit : undefined; resourceInputs["virtualmachineReservationMbit"] = state ? state.virtualmachineReservationMbit : undefined; resourceInputs["virtualmachineShareCount"] = state ? state.virtualmachineShareCount : undefined; resourceInputs["virtualmachineShareLevel"] = state ? state.virtualmachineShareLevel : undefined; resourceInputs["vlanId"] = state ? state.vlanId : undefined; resourceInputs["vlanRanges"] = state ? state.vlanRanges : undefined; resourceInputs["vmotionMaximumMbit"] = state ? state.vmotionMaximumMbit : undefined; resourceInputs["vmotionReservationMbit"] = state ? state.vmotionReservationMbit : undefined; resourceInputs["vmotionShareCount"] = state ? state.vmotionShareCount : undefined; resourceInputs["vmotionShareLevel"] = state ? state.vmotionShareLevel : undefined; resourceInputs["vsanMaximumMbit"] = state ? state.vsanMaximumMbit : undefined; resourceInputs["vsanReservationMbit"] = state ? state.vsanReservationMbit : undefined; resourceInputs["vsanShareCount"] = state ? state.vsanShareCount : undefined; resourceInputs["vsanShareLevel"] = state ? state.vsanShareLevel : undefined; } else { const args = argsOrState; if ((!args || args.datacenterId === undefined) && !opts.urn) { throw new Error("Missing required property 'datacenterId'"); } resourceInputs["activeUplinks"] = args ? args.activeUplinks : undefined; resourceInputs["allowForgedTransmits"] = args ? args.allowForgedTransmits : undefined; resourceInputs["allowMacChanges"] = args ? args.allowMacChanges : undefined; resourceInputs["allowPromiscuous"] = args ? args.allowPromiscuous : undefined; resourceInputs["backupnfcMaximumMbit"] = args ? args.backupnfcMaximumMbit : undefined; resourceInputs["backupnfcReservationMbit"] = args ? args.backupnfcReservationMbit : undefined; resourceInputs["backupnfcShareCount"] = args ? args.backupnfcShareCount : undefined; resourceInputs["backupnfcShareLevel"] = args ? args.backupnfcShareLevel : undefined; resourceInputs["blockAllPorts"] = args ? args.blockAllPorts : undefined; resourceInputs["checkBeacon"] = args ? args.checkBeacon : undefined; resourceInputs["contactDetail"] = args ? args.contactDetail : undefined; resourceInputs["contactName"] = args ? args.contactName : undefined; resourceInputs["customAttributes"] = args ? args.customAttributes : undefined; resourceInputs["datacenterId"] = args ? args.datacenterId : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["directpathGen2Allowed"] = args ? args.directpathGen2Allowed : undefined; resourceInputs["egressShapingAverageBandwidth"] = args ? args.egressShapingAverageBandwidth : undefined; resourceInputs["egressShapingBurstSize"] = args ? args.egressShapingBurstSize : undefined; resourceInputs["egressShapingEnabled"] = args ? args.egressShapingEnabled : undefined; resourceInputs["egressShapingPeakBandwidth"] = args ? args.egressShapingPeakBandwidth : undefined; resourceInputs["failback"] = args ? args.failback : undefined; resourceInputs["faulttoleranceMaximumMbit"] = args ? args.faulttoleranceMaximumMbit : undefined; resourceInputs["faulttoleranceReservationMbit"] = args ? args.faulttoleranceReservationMbit : undefined; resourceInputs["faulttoleranceShareCount"] = args ? args.faulttoleranceShareCount : undefined; resourceInputs["faulttoleranceShareLevel"] = args ? args.faulttoleranceShareLevel : undefined; resourceInputs["folder"] = args ? args.folder : undefined; resourceInputs["hbrMaximumMbit"] = args ? args.hbrMaximumMbit : undefined; resourceInputs["hbrReservationMbit"] = args ? args.hbrReservationMbit : undefined; resourceInputs["hbrShareCount"] = args ? args.hbrShareCount : undefined; resourceInputs["hbrShareLevel"] = args ? args.hbrShareLevel : undefined; resourceInputs["hosts"] = args ? args.hosts : undefined; resourceInputs["ignoreOtherPvlanMappings"] = args ? args.ignoreOtherPvlanMappings : undefined; resourceInputs["ingressShapingAverageBandwidth"] = args ? args.ingressShapingAverageBandwidth : undefined; resourceInputs["ingressShapingBurstSize"] = args ? args.ingressShapingBurstSize : undefined; resourceInputs["ingressShapingEnabled"] = args ? args.ingressShapingEnabled : undefined; resourceInputs["ingressShapingPeakBandwidth"] = args ? args.ingressShapingPeakBandwidth : undefined; resourceInputs["ipv4Address"] = args ? args.ipv4Address : undefined; resourceInputs["iscsiMaximumMbit"] = args ? args.iscsiMaximumMbit : undefined; resourceInputs["iscsiReservationMbit"] = args ? args.iscsiReservationMbit : undefined; resourceInputs["iscsiShareCount"] = args ? args.iscsiShareCount : undefined; resourceInputs["iscsiShareLevel"] = args ? args.iscsiShareLevel : undefined; resourceInputs["lacpApiVersion"] = args ? args.lacpApiVersion : undefined; resourceInputs["lacpEnabled"] = args ? args.lacpEnabled : undefined; resourceInputs["lacpMode"] = args ? args.lacpMode : undefined; resourceInputs["linkDiscoveryOperation"] = args ? args.linkDiscoveryOperation : undefined; resourceInputs["linkDiscoveryProtocol"] = args ? args.linkDiscoveryProtocol : undefined; resourceInputs["managementMaximumMbit"] = args ? args.managementMaximumMbit : undefined; resourceInputs["managementReservationMbit"] = args ? args.managementReservationMbit : undefined; resourceInputs["managementShareCount"] = args ? args.managementShareCount : undefined; resourceInputs["managementShareLevel"] = args ? args.managementShareLevel : undefined; resourceInputs["maxMtu"] = args ? args.maxMtu : undefined; resourceInputs["multicastFilteringMode"] = args ? args.multicastFilteringMode : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["netflowActiveFlowTimeout"] = args ? args.netflowActiveFlowTimeout : undefined; resourceInputs["netflowCollectorIpAddress"] = args ? args.netflowCollectorIpAddress : undefined; resourceInputs["netflowCollectorPort"] = args ? args.netflowCollectorPort : undefined; resourceInputs["netflowEnabled"] = args ? args.netflowEnabled : undefined; resourceInputs["netflowIdleFlowTimeout"] = args ? args.netflowIdleFlowTimeout : undefined; resourceInputs["netflowInternalFlowsOnly"] = args ? args.netflowInternalFlowsOnly : undefined; resourceInputs["netflowObservationDomainId"] = args ? args.netflowObservationDomainId : undefined; resourceInputs["netflowSamplingRate"] = args ? args.netflowSamplingRate : undefined; resourceInputs["networkResourceControlEnabled"] = args ? args.networkResourceControlEnabled : undefined; resourceInputs["networkResourceControlVersion"] = args ? args.networkResourceControlVersion : undefined; resourceInputs["nfsMaximumMbit"] = args ? args.nfsMaximumMbit : undefined; resourceInputs["nfsReservationMbit"] = args ? args.nfsReservationMbit : undefined; resourceInputs["nfsShareCount"] = args ? args.nfsShareCount : undefined; resourceInputs["nfsShareLevel"] = args ? args.nfsShareLevel : undefined; resourceInputs["notifySwitches"] = args ? args.notifySwitches : undefined; resourceInputs["portPrivateSecondaryVlanId"] = args ? args.portPrivateSecondaryVlanId : undefined; resourceInputs["pvlanMappings"] = args ? args.pvlanMappings : undefined; resourceInputs["standbyUplinks"] = args ? args.standbyUplinks : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["teamingPolicy"] = args ? args.teamingPolicy : undefined; resourceInputs["txUplink"] = args ? args.txUplink : undefined; resourceInputs["uplinks"] = args ? args.uplinks : undefined; resourceInputs["vdpMaximumMbit"] = args ? args.vdpMaximumMbit : undefined; resourceInputs["vdpReservationMbit"] = args ? args.vdpReservationMbit : undefined; resourceInputs["vdpShareCount"] = args ? args.vdpShareCount : undefined; resourceInputs["vdpShareLevel"] = args ? args.vdpShareLevel : undefined; resourceInputs["version"] = args ? args.version : undefined; resourceInputs["virtualmachineMaximumMbit"] = args ? args.virtualmachineMaximumMbit : undefined; resourceInputs["virtualmachineReservationMbit"] = args ? args.virtualmachineReservationMbit : undefined; resourceInputs["virtualmachineShareCount"] = args ? args.virtualmachineShareCount : undefined; resourceInputs["virtualmachineShareLevel"] = args ? args.virtualmachineShareLevel : undefined; resourceInputs["vlanId"] = args ? args.vlanId : undefined; resourceInputs["vlanRanges"] = args ? args.vlanRanges : undefined; resourceInputs["vmotionMaximumMbit"] = args ? args.vmotionMaximumMbit : undefined; resourceInputs["vmotionReservationMbit"] = args ? args.vmotionReservationMbit : undefined; resourceInputs["vmotionShareCount"] = args ? args.vmotionShareCount : undefined; resourceInputs["vmotionShareLevel"] = args ? args.vmotionShareLevel : undefined; resourceInputs["vsanMaximumMbit"] = args ? args.vsanMaximumMbit : undefined; resourceInputs["vsanReservationMbit"] = args ? args.vsanReservationMbit : undefined; resourceInputs["vsanShareCount"] = args ? args.vsanShareCount : undefined; resourceInputs["vsanShareLevel"] = args ? args.vsanShareLevel : undefined; resourceInputs["configVersion"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DistributedVirtualSwitch.__pulumiType, name, resourceInputs, opts); } } exports.DistributedVirtualSwitch = DistributedVirtualSwitch; /** @internal */ DistributedVirtualSwitch.__pulumiType = 'vsphere:index/distributedVirtualSwitch:DistributedVirtualSwitch'; //# sourceMappingURL=distributedVirtualSwitch.js.map