GetDistributedVirtualSwitch
The vsphere..DistributedVirtualSwitch data source can be used to discover
the ID and uplink data of a of a vSphere distributed virtual switch (DVS). This
can then be used with resources or data sources that require a DVS, such as the
vsphere..DistributedPortGroup resource, for which
an example is shown below.
NOTE: This data source requires vCenter and is not available on direct ESXi connections.
Example Usage
using Pulumi;
using VSphere = Pulumi.VSphere;
class MyStack : Stack
{
public MyStack()
{
var datacenter = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
{
Name = "dc1",
}));
var dvs = datacenter.Apply(datacenter => Output.Create(VSphere.GetDistributedVirtualSwitch.InvokeAsync(new VSphere.GetDistributedVirtualSwitchArgs
{
DatacenterId = datacenter.Id,
Name = "test-dvs",
})));
var pg = new VSphere.DistributedPortGroup("pg", new VSphere.DistributedPortGroupArgs
{
ActiveUplinks =
{
dvs.Apply(dvs => dvs.Uplinks[0]),
},
DistributedVirtualSwitchUuid = dvs.Apply(dvs => dvs.Id),
StandbyUplinks =
{
dvs.Apply(dvs => dvs.Uplinks[1]),
},
});
}
}
Coming soon!
import pulumi
import pulumi_vsphere as vsphere
datacenter = vsphere.get_datacenter(name="dc1")
dvs = vsphere.get_distributed_virtual_switch(datacenter_id=datacenter.id,
name="test-dvs")
pg = vsphere.DistributedPortGroup("pg",
active_uplinks=[dvs.uplinks[0]],
distributed_virtual_switch_uuid=dvs.id,
standby_uplinks=[dvs.uplinks[1]])import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const datacenter = pulumi.output(vsphere.getDatacenter({
name: "dc1",
}, { async: true }));
const dvs = datacenter.apply(datacenter => vsphere.getDistributedVirtualSwitch({
datacenterId: datacenter.id,
name: "test-dvs",
}, { async: true }));
const pg = new vsphere.DistributedPortGroup("pg", {
activeUplinks: [dvs.apply(dvs => dvs.uplinks[0])],
distributedVirtualSwitchUuid: dvs.id,
standbyUplinks: [dvs.apply(dvs => dvs.uplinks[1])],
});Using GetDistributedVirtualSwitch
function getDistributedVirtualSwitch(args: GetDistributedVirtualSwitchArgs, opts?: InvokeOptions): Promise<GetDistributedVirtualSwitchResult>function get_distributed_virtual_switch(datacenter_id=None, name=None, opts=None)func LookupDistributedVirtualSwitch(ctx *Context, args *LookupDistributedVirtualSwitchArgs, opts ...InvokeOption) (*LookupDistributedVirtualSwitchResult, error)Note: This function is named
LookupDistributedVirtualSwitchin the Go SDK.
public static class GetDistributedVirtualSwitch {
public static Task<GetDistributedVirtualSwitchResult> InvokeAsync(GetDistributedVirtualSwitchArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Name string
The name of the distributed virtual switch. This can be a name or path.
- Datacenter
Id string The managed object reference ID of the datacenter the DVS is located in. This can be omitted if the search path used in
nameis an absolute path. For default datacenters, use the id attribute from an emptyvsphere..Datacenterdata source.
- Name string
The name of the distributed virtual switch. This can be a name or path.
- Datacenter
Id string The managed object reference ID of the datacenter the DVS is located in. This can be omitted if the search path used in
nameis an absolute path. For default datacenters, use the id attribute from an emptyvsphere..Datacenterdata source.
- name string
The name of the distributed virtual switch. This can be a name or path.
- datacenter
Id string The managed object reference ID of the datacenter the DVS is located in. This can be omitted if the search path used in
nameis an absolute path. For default datacenters, use the id attribute from an emptyvsphere..Datacenterdata source.
- name str
The name of the distributed virtual switch. This can be a name or path.
- datacenter_
id str The managed object reference ID of the datacenter the DVS is located in. This can be omitted if the search path used in
nameis an absolute path. For default datacenters, use the id attribute from an emptyvsphere..Datacenterdata source.
GetDistributedVirtualSwitch Result
The following output properties are available:
- Id string
The provider-assigned unique ID for this managed resource.
- Name string
- Uplinks List<string>
- Datacenter
Id string
Package Details
- Repository
- https://github.com/pulumi/pulumi-vsphere
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
vsphereTerraform Provider.