@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
96 lines • 4 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.getDistributedVirtualSwitchOutput = exports.getDistributedVirtualSwitch = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* The `vsphere.DistributedVirtualSwitch` data source can be used to discover
* the ID and uplink data of a of a vSphere distributed switch (VDS). This
* can then be used with resources or data sources that require a VDS, such as the
* `vsphere.DistributedPortGroup` resource, for which
* an example is shown below.
*
* > **NOTE:** This data source requires vCenter Server and is not available on
* direct ESXi host connections.
*
* ## Example Usage
*
* The following example locates a distributed switch named `vds-01`, in the
* datacenter `dc-01`. It then uses this distributed switch to set up a
* `vsphere.DistributedPortGroup` resource that uses the first uplink as a
* primary uplink and the second uplink as a secondary.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const datacenter = vsphere.getDatacenter({
* name: "dc-01",
* });
* const vds = datacenter.then(datacenter => vsphere.getDistributedVirtualSwitch({
* name: "vds-01",
* datacenterId: datacenter.id,
* }));
* const dvpg = new vsphere.DistributedPortGroup("dvpg", {
* name: "dvpg-01",
* distributedVirtualSwitchUuid: vds.then(vds => vds.id),
* activeUplinks: [vds.then(vds => vds.uplinks?.[0])],
* standbyUplinks: [vds.then(vds => vds.uplinks?.[1])],
* });
* ```
*/
function getDistributedVirtualSwitch(args, opts) {
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invoke("vsphere:index/getDistributedVirtualSwitch:getDistributedVirtualSwitch", {
"datacenterId": args.datacenterId,
"name": args.name,
}, opts);
}
exports.getDistributedVirtualSwitch = getDistributedVirtualSwitch;
/**
* The `vsphere.DistributedVirtualSwitch` data source can be used to discover
* the ID and uplink data of a of a vSphere distributed switch (VDS). This
* can then be used with resources or data sources that require a VDS, such as the
* `vsphere.DistributedPortGroup` resource, for which
* an example is shown below.
*
* > **NOTE:** This data source requires vCenter Server and is not available on
* direct ESXi host connections.
*
* ## Example Usage
*
* The following example locates a distributed switch named `vds-01`, in the
* datacenter `dc-01`. It then uses this distributed switch to set up a
* `vsphere.DistributedPortGroup` resource that uses the first uplink as a
* primary uplink and the second uplink as a secondary.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const datacenter = vsphere.getDatacenter({
* name: "dc-01",
* });
* const vds = datacenter.then(datacenter => vsphere.getDistributedVirtualSwitch({
* name: "vds-01",
* datacenterId: datacenter.id,
* }));
* const dvpg = new vsphere.DistributedPortGroup("dvpg", {
* name: "dvpg-01",
* distributedVirtualSwitchUuid: vds.then(vds => vds.id),
* activeUplinks: [vds.then(vds => vds.uplinks?.[0])],
* standbyUplinks: [vds.then(vds => vds.uplinks?.[1])],
* });
* ```
*/
function getDistributedVirtualSwitchOutput(args, opts) {
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invokeOutput("vsphere:index/getDistributedVirtualSwitch:getDistributedVirtualSwitch", {
"datacenterId": args.datacenterId,
"name": args.name,
}, opts);
}
exports.getDistributedVirtualSwitchOutput = getDistributedVirtualSwitchOutput;
//# sourceMappingURL=getDistributedVirtualSwitch.js.map