vsphere.Vnic
Explore with Pulumi AI
Provides a VMware vSphere vnic resource.
Example Usage
S
Create a vnic attached to a distributed virtual switch using the vmotion TCP/IP stack
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const dc = vsphere.getDatacenter({
    name: "mydc",
});
const h1 = dc.then(dc => vsphere.getHost({
    name: "esxi1.host.test",
    datacenterId: dc.id,
}));
const d1 = new vsphere.DistributedVirtualSwitch("d1", {
    name: "dc_DVPG0",
    datacenterId: dc.then(dc => dc.id),
    hosts: [{
        hostSystemId: h1.then(h1 => h1.id),
        devices: ["vnic3"],
    }],
});
const p1 = new vsphere.DistributedPortGroup("p1", {
    name: "test-pg",
    vlanId: 1234,
    distributedVirtualSwitchUuid: d1.id,
});
const v1 = new vsphere.Vnic("v1", {
    host: h1.then(h1 => h1.id),
    distributedSwitchPort: d1.id,
    distributedPortGroup: p1.id,
    ipv4: {
        dhcp: true,
    },
    netstack: "vmotion",
});
import pulumi
import pulumi_vsphere as vsphere
dc = vsphere.get_datacenter(name="mydc")
h1 = vsphere.get_host(name="esxi1.host.test",
    datacenter_id=dc.id)
d1 = vsphere.DistributedVirtualSwitch("d1",
    name="dc_DVPG0",
    datacenter_id=dc.id,
    hosts=[vsphere.DistributedVirtualSwitchHostArgs(
        host_system_id=h1.id,
        devices=["vnic3"],
    )])
p1 = vsphere.DistributedPortGroup("p1",
    name="test-pg",
    vlan_id=1234,
    distributed_virtual_switch_uuid=d1.id)
v1 = vsphere.Vnic("v1",
    host=h1.id,
    distributed_switch_port=d1.id,
    distributed_port_group=p1.id,
    ipv4=vsphere.VnicIpv4Args(
        dhcp=True,
    ),
    netstack="vmotion")
package main
import (
	"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		dc, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{
			Name: pulumi.StringRef("mydc"),
		}, nil)
		if err != nil {
			return err
		}
		h1, err := vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{
			Name:         pulumi.StringRef("esxi1.host.test"),
			DatacenterId: dc.Id,
		}, nil)
		if err != nil {
			return err
		}
		d1, err := vsphere.NewDistributedVirtualSwitch(ctx, "d1", &vsphere.DistributedVirtualSwitchArgs{
			Name:         pulumi.String("dc_DVPG0"),
			DatacenterId: pulumi.String(dc.Id),
			Hosts: vsphere.DistributedVirtualSwitchHostArray{
				&vsphere.DistributedVirtualSwitchHostArgs{
					HostSystemId: pulumi.String(h1.Id),
					Devices: pulumi.StringArray{
						pulumi.String("vnic3"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		p1, err := vsphere.NewDistributedPortGroup(ctx, "p1", &vsphere.DistributedPortGroupArgs{
			Name:                         pulumi.String("test-pg"),
			VlanId:                       pulumi.Int(1234),
			DistributedVirtualSwitchUuid: d1.ID(),
		})
		if err != nil {
			return err
		}
		_, err = vsphere.NewVnic(ctx, "v1", &vsphere.VnicArgs{
			Host:                  pulumi.String(h1.Id),
			DistributedSwitchPort: d1.ID(),
			DistributedPortGroup:  p1.ID(),
			Ipv4: &vsphere.VnicIpv4Args{
				Dhcp: pulumi.Bool(true),
			},
			Netstack: pulumi.String("vmotion"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using VSphere = Pulumi.VSphere;
return await Deployment.RunAsync(() => 
{
    var dc = VSphere.GetDatacenter.Invoke(new()
    {
        Name = "mydc",
    });
    var h1 = VSphere.GetHost.Invoke(new()
    {
        Name = "esxi1.host.test",
        DatacenterId = dc.Apply(getDatacenterResult => getDatacenterResult.Id),
    });
    var d1 = new VSphere.DistributedVirtualSwitch("d1", new()
    {
        Name = "dc_DVPG0",
        DatacenterId = dc.Apply(getDatacenterResult => getDatacenterResult.Id),
        Hosts = new[]
        {
            new VSphere.Inputs.DistributedVirtualSwitchHostArgs
            {
                HostSystemId = h1.Apply(getHostResult => getHostResult.Id),
                Devices = new[]
                {
                    "vnic3",
                },
            },
        },
    });
    var p1 = new VSphere.DistributedPortGroup("p1", new()
    {
        Name = "test-pg",
        VlanId = 1234,
        DistributedVirtualSwitchUuid = d1.Id,
    });
    var v1 = new VSphere.Vnic("v1", new()
    {
        Host = h1.Apply(getHostResult => getHostResult.Id),
        DistributedSwitchPort = d1.Id,
        DistributedPortGroup = p1.Id,
        Ipv4 = new VSphere.Inputs.VnicIpv4Args
        {
            Dhcp = true,
        },
        Netstack = "vmotion",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vsphere.VsphereFunctions;
import com.pulumi.vsphere.inputs.GetDatacenterArgs;
import com.pulumi.vsphere.inputs.GetHostArgs;
import com.pulumi.vsphere.DistributedVirtualSwitch;
import com.pulumi.vsphere.DistributedVirtualSwitchArgs;
import com.pulumi.vsphere.inputs.DistributedVirtualSwitchHostArgs;
import com.pulumi.vsphere.DistributedPortGroup;
import com.pulumi.vsphere.DistributedPortGroupArgs;
import com.pulumi.vsphere.Vnic;
import com.pulumi.vsphere.VnicArgs;
import com.pulumi.vsphere.inputs.VnicIpv4Args;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var dc = VsphereFunctions.getDatacenter(GetDatacenterArgs.builder()
            .name("mydc")
            .build());
        final var h1 = VsphereFunctions.getHost(GetHostArgs.builder()
            .name("esxi1.host.test")
            .datacenterId(dc.applyValue(getDatacenterResult -> getDatacenterResult.id()))
            .build());
        var d1 = new DistributedVirtualSwitch("d1", DistributedVirtualSwitchArgs.builder()        
            .name("dc_DVPG0")
            .datacenterId(dc.applyValue(getDatacenterResult -> getDatacenterResult.id()))
            .hosts(DistributedVirtualSwitchHostArgs.builder()
                .hostSystemId(h1.applyValue(getHostResult -> getHostResult.id()))
                .devices("vnic3")
                .build())
            .build());
        var p1 = new DistributedPortGroup("p1", DistributedPortGroupArgs.builder()        
            .name("test-pg")
            .vlanId(1234)
            .distributedVirtualSwitchUuid(d1.id())
            .build());
        var v1 = new Vnic("v1", VnicArgs.builder()        
            .host(h1.applyValue(getHostResult -> getHostResult.id()))
            .distributedSwitchPort(d1.id())
            .distributedPortGroup(p1.id())
            .ipv4(VnicIpv4Args.builder()
                .dhcp(true)
                .build())
            .netstack("vmotion")
            .build());
    }
}
resources:
  d1:
    type: vsphere:DistributedVirtualSwitch
    properties:
      name: dc_DVPG0
      datacenterId: ${dc.id}
      hosts:
        - hostSystemId: ${h1.id}
          devices:
            - vnic3
  p1:
    type: vsphere:DistributedPortGroup
    properties:
      name: test-pg
      vlanId: 1234
      distributedVirtualSwitchUuid: ${d1.id}
  v1:
    type: vsphere:Vnic
    properties:
      host: ${h1.id}
      distributedSwitchPort: ${d1.id}
      distributedPortGroup: ${p1.id}
      ipv4:
        dhcp: true
      netstack: vmotion
variables:
  dc:
    fn::invoke:
      Function: vsphere:getDatacenter
      Arguments:
        name: mydc
  h1:
    fn::invoke:
      Function: vsphere:getHost
      Arguments:
        name: esxi1.host.test
        datacenterId: ${dc.id}
Create a vnic attached to a portgroup using the default TCP/IP stack
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const dc = vsphere.getDatacenter({
    name: "mydc",
});
const h1 = dc.then(dc => vsphere.getHost({
    name: "esxi1.host.test",
    datacenterId: dc.id,
}));
const hvs1 = new vsphere.HostVirtualSwitch("hvs1", {
    name: "dc_HPG0",
    hostSystemId: h1.then(h1 => h1.id),
    networkAdapters: [
        "vmnic3",
        "vmnic4",
    ],
    activeNics: ["vmnic3"],
    standbyNics: ["vmnic4"],
});
const p1 = new vsphere.HostPortGroup("p1", {
    name: "my-pg",
    virtualSwitchName: hvs1.name,
    hostSystemId: h1.then(h1 => h1.id),
});
const v1 = new vsphere.Vnic("v1", {
    host: h1.then(h1 => h1.id),
    portgroup: p1.name,
    ipv4: {
        dhcp: true,
    },
    services: [
        "vsan",
        "management",
    ],
});
import pulumi
import pulumi_vsphere as vsphere
dc = vsphere.get_datacenter(name="mydc")
h1 = vsphere.get_host(name="esxi1.host.test",
    datacenter_id=dc.id)
hvs1 = vsphere.HostVirtualSwitch("hvs1",
    name="dc_HPG0",
    host_system_id=h1.id,
    network_adapters=[
        "vmnic3",
        "vmnic4",
    ],
    active_nics=["vmnic3"],
    standby_nics=["vmnic4"])
p1 = vsphere.HostPortGroup("p1",
    name="my-pg",
    virtual_switch_name=hvs1.name,
    host_system_id=h1.id)
v1 = vsphere.Vnic("v1",
    host=h1.id,
    portgroup=p1.name,
    ipv4=vsphere.VnicIpv4Args(
        dhcp=True,
    ),
    services=[
        "vsan",
        "management",
    ])
package main
import (
	"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		dc, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{
			Name: pulumi.StringRef("mydc"),
		}, nil)
		if err != nil {
			return err
		}
		h1, err := vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{
			Name:         pulumi.StringRef("esxi1.host.test"),
			DatacenterId: dc.Id,
		}, nil)
		if err != nil {
			return err
		}
		hvs1, err := vsphere.NewHostVirtualSwitch(ctx, "hvs1", &vsphere.HostVirtualSwitchArgs{
			Name:         pulumi.String("dc_HPG0"),
			HostSystemId: pulumi.String(h1.Id),
			NetworkAdapters: pulumi.StringArray{
				pulumi.String("vmnic3"),
				pulumi.String("vmnic4"),
			},
			ActiveNics: pulumi.StringArray{
				pulumi.String("vmnic3"),
			},
			StandbyNics: pulumi.StringArray{
				pulumi.String("vmnic4"),
			},
		})
		if err != nil {
			return err
		}
		p1, err := vsphere.NewHostPortGroup(ctx, "p1", &vsphere.HostPortGroupArgs{
			Name:              pulumi.String("my-pg"),
			VirtualSwitchName: hvs1.Name,
			HostSystemId:      pulumi.String(h1.Id),
		})
		if err != nil {
			return err
		}
		_, err = vsphere.NewVnic(ctx, "v1", &vsphere.VnicArgs{
			Host:      pulumi.String(h1.Id),
			Portgroup: p1.Name,
			Ipv4: &vsphere.VnicIpv4Args{
				Dhcp: pulumi.Bool(true),
			},
			Services: pulumi.StringArray{
				pulumi.String("vsan"),
				pulumi.String("management"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using VSphere = Pulumi.VSphere;
return await Deployment.RunAsync(() => 
{
    var dc = VSphere.GetDatacenter.Invoke(new()
    {
        Name = "mydc",
    });
    var h1 = VSphere.GetHost.Invoke(new()
    {
        Name = "esxi1.host.test",
        DatacenterId = dc.Apply(getDatacenterResult => getDatacenterResult.Id),
    });
    var hvs1 = new VSphere.HostVirtualSwitch("hvs1", new()
    {
        Name = "dc_HPG0",
        HostSystemId = h1.Apply(getHostResult => getHostResult.Id),
        NetworkAdapters = new[]
        {
            "vmnic3",
            "vmnic4",
        },
        ActiveNics = new[]
        {
            "vmnic3",
        },
        StandbyNics = new[]
        {
            "vmnic4",
        },
    });
    var p1 = new VSphere.HostPortGroup("p1", new()
    {
        Name = "my-pg",
        VirtualSwitchName = hvs1.Name,
        HostSystemId = h1.Apply(getHostResult => getHostResult.Id),
    });
    var v1 = new VSphere.Vnic("v1", new()
    {
        Host = h1.Apply(getHostResult => getHostResult.Id),
        Portgroup = p1.Name,
        Ipv4 = new VSphere.Inputs.VnicIpv4Args
        {
            Dhcp = true,
        },
        Services = new[]
        {
            "vsan",
            "management",
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vsphere.VsphereFunctions;
import com.pulumi.vsphere.inputs.GetDatacenterArgs;
import com.pulumi.vsphere.inputs.GetHostArgs;
import com.pulumi.vsphere.HostVirtualSwitch;
import com.pulumi.vsphere.HostVirtualSwitchArgs;
import com.pulumi.vsphere.HostPortGroup;
import com.pulumi.vsphere.HostPortGroupArgs;
import com.pulumi.vsphere.Vnic;
import com.pulumi.vsphere.VnicArgs;
import com.pulumi.vsphere.inputs.VnicIpv4Args;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var dc = VsphereFunctions.getDatacenter(GetDatacenterArgs.builder()
            .name("mydc")
            .build());
        final var h1 = VsphereFunctions.getHost(GetHostArgs.builder()
            .name("esxi1.host.test")
            .datacenterId(dc.applyValue(getDatacenterResult -> getDatacenterResult.id()))
            .build());
        var hvs1 = new HostVirtualSwitch("hvs1", HostVirtualSwitchArgs.builder()        
            .name("dc_HPG0")
            .hostSystemId(h1.applyValue(getHostResult -> getHostResult.id()))
            .networkAdapters(            
                "vmnic3",
                "vmnic4")
            .activeNics("vmnic3")
            .standbyNics("vmnic4")
            .build());
        var p1 = new HostPortGroup("p1", HostPortGroupArgs.builder()        
            .name("my-pg")
            .virtualSwitchName(hvs1.name())
            .hostSystemId(h1.applyValue(getHostResult -> getHostResult.id()))
            .build());
        var v1 = new Vnic("v1", VnicArgs.builder()        
            .host(h1.applyValue(getHostResult -> getHostResult.id()))
            .portgroup(p1.name())
            .ipv4(VnicIpv4Args.builder()
                .dhcp(true)
                .build())
            .services(            
                "vsan",
                "management")
            .build());
    }
}
resources:
  hvs1:
    type: vsphere:HostVirtualSwitch
    properties:
      name: dc_HPG0
      hostSystemId: ${h1.id}
      networkAdapters:
        - vmnic3
        - vmnic4
      activeNics:
        - vmnic3
      standbyNics:
        - vmnic4
  p1:
    type: vsphere:HostPortGroup
    properties:
      name: my-pg
      virtualSwitchName: ${hvs1.name}
      hostSystemId: ${h1.id}
  v1:
    type: vsphere:Vnic
    properties:
      host: ${h1.id}
      portgroup: ${p1.name}
      ipv4:
        dhcp: true
      services:
        - vsan
        - management
variables:
  dc:
    fn::invoke:
      Function: vsphere:getDatacenter
      Arguments:
        name: mydc
  h1:
    fn::invoke:
      Function: vsphere:getHost
      Arguments:
        name: esxi1.host.test
        datacenterId: ${dc.id}
Create Vnic Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Vnic(name: string, args: VnicArgs, opts?: CustomResourceOptions);@overload
def Vnic(resource_name: str,
         args: VnicArgs,
         opts: Optional[ResourceOptions] = None)
@overload
def Vnic(resource_name: str,
         opts: Optional[ResourceOptions] = None,
         host: Optional[str] = None,
         distributed_port_group: Optional[str] = None,
         distributed_switch_port: Optional[str] = None,
         ipv4: Optional[VnicIpv4Args] = None,
         ipv6: Optional[VnicIpv6Args] = None,
         mac: Optional[str] = None,
         mtu: Optional[int] = None,
         netstack: Optional[str] = None,
         portgroup: Optional[str] = None,
         services: Optional[Sequence[str]] = None)func NewVnic(ctx *Context, name string, args VnicArgs, opts ...ResourceOption) (*Vnic, error)public Vnic(string name, VnicArgs args, CustomResourceOptions? opts = null)type: vsphere:Vnic
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
 - The unique name of the resource.
 - args VnicArgs
 - The arguments to resource properties.
 - opts CustomResourceOptions
 - Bag of options to control resource's behavior.
 
- resource_name str
 - The unique name of the resource.
 - args VnicArgs
 - The arguments to resource properties.
 - opts ResourceOptions
 - Bag of options to control resource's behavior.
 
- ctx Context
 - Context object for the current deployment.
 - name string
 - The unique name of the resource.
 - args VnicArgs
 - The arguments to resource properties.
 - opts ResourceOption
 - Bag of options to control resource's behavior.
 
- name string
 - The unique name of the resource.
 - args VnicArgs
 - The arguments to resource properties.
 - opts CustomResourceOptions
 - Bag of options to control resource's behavior.
 
- name String
 - The unique name of the resource.
 - args VnicArgs
 - The arguments to resource properties.
 - options CustomResourceOptions
 - Bag of options to control resource's behavior.
 
Constructor example
The following reference example uses placeholder values for all input properties.
var vnicResource = new VSphere.Vnic("vnicResource", new()
{
    Host = "string",
    DistributedPortGroup = "string",
    DistributedSwitchPort = "string",
    Ipv4 = new VSphere.Inputs.VnicIpv4Args
    {
        Dhcp = false,
        Gw = "string",
        Ip = "string",
        Netmask = "string",
    },
    Ipv6 = new VSphere.Inputs.VnicIpv6Args
    {
        Addresses = new[]
        {
            "string",
        },
        Autoconfig = false,
        Dhcp = false,
        Gw = "string",
    },
    Mac = "string",
    Mtu = 0,
    Netstack = "string",
    Portgroup = "string",
    Services = new[]
    {
        "string",
    },
});
example, err := vsphere.NewVnic(ctx, "vnicResource", &vsphere.VnicArgs{
	Host:                  pulumi.String("string"),
	DistributedPortGroup:  pulumi.String("string"),
	DistributedSwitchPort: pulumi.String("string"),
	Ipv4: &vsphere.VnicIpv4Args{
		Dhcp:    pulumi.Bool(false),
		Gw:      pulumi.String("string"),
		Ip:      pulumi.String("string"),
		Netmask: pulumi.String("string"),
	},
	Ipv6: &vsphere.VnicIpv6Args{
		Addresses: pulumi.StringArray{
			pulumi.String("string"),
		},
		Autoconfig: pulumi.Bool(false),
		Dhcp:       pulumi.Bool(false),
		Gw:         pulumi.String("string"),
	},
	Mac:       pulumi.String("string"),
	Mtu:       pulumi.Int(0),
	Netstack:  pulumi.String("string"),
	Portgroup: pulumi.String("string"),
	Services: pulumi.StringArray{
		pulumi.String("string"),
	},
})
var vnicResource = new Vnic("vnicResource", VnicArgs.builder()
    .host("string")
    .distributedPortGroup("string")
    .distributedSwitchPort("string")
    .ipv4(VnicIpv4Args.builder()
        .dhcp(false)
        .gw("string")
        .ip("string")
        .netmask("string")
        .build())
    .ipv6(VnicIpv6Args.builder()
        .addresses("string")
        .autoconfig(false)
        .dhcp(false)
        .gw("string")
        .build())
    .mac("string")
    .mtu(0)
    .netstack("string")
    .portgroup("string")
    .services("string")
    .build());
vnic_resource = vsphere.Vnic("vnicResource",
    host="string",
    distributed_port_group="string",
    distributed_switch_port="string",
    ipv4=vsphere.VnicIpv4Args(
        dhcp=False,
        gw="string",
        ip="string",
        netmask="string",
    ),
    ipv6=vsphere.VnicIpv6Args(
        addresses=["string"],
        autoconfig=False,
        dhcp=False,
        gw="string",
    ),
    mac="string",
    mtu=0,
    netstack="string",
    portgroup="string",
    services=["string"])
const vnicResource = new vsphere.Vnic("vnicResource", {
    host: "string",
    distributedPortGroup: "string",
    distributedSwitchPort: "string",
    ipv4: {
        dhcp: false,
        gw: "string",
        ip: "string",
        netmask: "string",
    },
    ipv6: {
        addresses: ["string"],
        autoconfig: false,
        dhcp: false,
        gw: "string",
    },
    mac: "string",
    mtu: 0,
    netstack: "string",
    portgroup: "string",
    services: ["string"],
});
type: vsphere:Vnic
properties:
    distributedPortGroup: string
    distributedSwitchPort: string
    host: string
    ipv4:
        dhcp: false
        gw: string
        ip: string
        netmask: string
    ipv6:
        addresses:
            - string
        autoconfig: false
        dhcp: false
        gw: string
    mac: string
    mtu: 0
    netstack: string
    portgroup: string
    services:
        - string
Vnic Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Vnic resource accepts the following input properties:
- Host string
 - ESX host the interface belongs to
 - Distributed
Port stringGroup  - Key of the distributed portgroup the nic will connect to.
 - Distributed
Switch stringPort  - UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
 - Ipv4
Pulumi.
VSphere. Inputs. Vnic Ipv4  - IPv4 settings. Either this or 
ipv6needs to be set. See IPv4 options below. - Ipv6
Pulumi.
VSphere. Inputs. Vnic Ipv6  - IPv6 settings. Either this or 
ipv6needs to be set. See IPv6 options below. - Mac string
 - MAC address of the interface.
 - Mtu int
 - MTU of the interface.
 - Netstack string
 - TCP/IP stack setting for this interface. Possible values are 
defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:defaultTcpipStack`) - Portgroup string
 - Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
 - Services List<string>
 - Enabled services setting for this interface. Currently support values are 
vmotion,management, andvsan. 
- Host string
 - ESX host the interface belongs to
 - Distributed
Port stringGroup  - Key of the distributed portgroup the nic will connect to.
 - Distributed
Switch stringPort  - UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
 - Ipv4
Vnic
Ipv4Args  - IPv4 settings. Either this or 
ipv6needs to be set. See IPv4 options below. - Ipv6
Vnic
Ipv6Args  - IPv6 settings. Either this or 
ipv6needs to be set. See IPv6 options below. - Mac string
 - MAC address of the interface.
 - Mtu int
 - MTU of the interface.
 - Netstack string
 - TCP/IP stack setting for this interface. Possible values are 
defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:defaultTcpipStack`) - Portgroup string
 - Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
 - Services []string
 - Enabled services setting for this interface. Currently support values are 
vmotion,management, andvsan. 
- host String
 - ESX host the interface belongs to
 - distributed
Port StringGroup  - Key of the distributed portgroup the nic will connect to.
 - distributed
Switch StringPort  - UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
 - ipv4
Vnic
Ipv4  - IPv4 settings. Either this or 
ipv6needs to be set. See IPv4 options below. - ipv6
Vnic
Ipv6  - IPv6 settings. Either this or 
ipv6needs to be set. See IPv6 options below. - mac String
 - MAC address of the interface.
 - mtu Integer
 - MTU of the interface.
 - netstack String
 - TCP/IP stack setting for this interface. Possible values are 
defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:defaultTcpipStack`) - portgroup String
 - Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
 - services List<String>
 - Enabled services setting for this interface. Currently support values are 
vmotion,management, andvsan. 
- host string
 - ESX host the interface belongs to
 - distributed
Port stringGroup  - Key of the distributed portgroup the nic will connect to.
 - distributed
Switch stringPort  - UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
 - ipv4
Vnic
Ipv4  - IPv4 settings. Either this or 
ipv6needs to be set. See IPv4 options below. - ipv6
Vnic
Ipv6  - IPv6 settings. Either this or 
ipv6needs to be set. See IPv6 options below. - mac string
 - MAC address of the interface.
 - mtu number
 - MTU of the interface.
 - netstack string
 - TCP/IP stack setting for this interface. Possible values are 
defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:defaultTcpipStack`) - portgroup string
 - Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
 - services string[]
 - Enabled services setting for this interface. Currently support values are 
vmotion,management, andvsan. 
- host str
 - ESX host the interface belongs to
 - distributed_
port_ strgroup  - Key of the distributed portgroup the nic will connect to.
 - distributed_
switch_ strport  - UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
 - ipv4
Vnic
Ipv4Args  - IPv4 settings. Either this or 
ipv6needs to be set. See IPv4 options below. - ipv6
Vnic
Ipv6Args  - IPv6 settings. Either this or 
ipv6needs to be set. See IPv6 options below. - mac str
 - MAC address of the interface.
 - mtu int
 - MTU of the interface.
 - netstack str
 - TCP/IP stack setting for this interface. Possible values are 
defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:defaultTcpipStack`) - portgroup str
 - Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
 - services Sequence[str]
 - Enabled services setting for this interface. Currently support values are 
vmotion,management, andvsan. 
- host String
 - ESX host the interface belongs to
 - distributed
Port StringGroup  - Key of the distributed portgroup the nic will connect to.
 - distributed
Switch StringPort  - UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
 - ipv4 Property Map
 - IPv4 settings. Either this or 
ipv6needs to be set. See IPv4 options below. - ipv6 Property Map
 - IPv6 settings. Either this or 
ipv6needs to be set. See IPv6 options below. - mac String
 - MAC address of the interface.
 - mtu Number
 - MTU of the interface.
 - netstack String
 - TCP/IP stack setting for this interface. Possible values are 
defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:defaultTcpipStack`) - portgroup String
 - Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
 - services List<String>
 - Enabled services setting for this interface. Currently support values are 
vmotion,management, andvsan. 
Outputs
All input properties are implicitly available as output properties. Additionally, the Vnic resource produces the following output properties:
- Id string
 - The provider-assigned unique ID for this managed resource.
 
- Id string
 - The provider-assigned unique ID for this managed resource.
 
- id String
 - The provider-assigned unique ID for this managed resource.
 
- id string
 - The provider-assigned unique ID for this managed resource.
 
- id str
 - The provider-assigned unique ID for this managed resource.
 
- id String
 - The provider-assigned unique ID for this managed resource.
 
Look up Existing Vnic Resource
Get an existing Vnic resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: VnicState, opts?: CustomResourceOptions): Vnic@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        distributed_port_group: Optional[str] = None,
        distributed_switch_port: Optional[str] = None,
        host: Optional[str] = None,
        ipv4: Optional[VnicIpv4Args] = None,
        ipv6: Optional[VnicIpv6Args] = None,
        mac: Optional[str] = None,
        mtu: Optional[int] = None,
        netstack: Optional[str] = None,
        portgroup: Optional[str] = None,
        services: Optional[Sequence[str]] = None) -> Vnicfunc GetVnic(ctx *Context, name string, id IDInput, state *VnicState, opts ...ResourceOption) (*Vnic, error)public static Vnic Get(string name, Input<string> id, VnicState? state, CustomResourceOptions? opts = null)public static Vnic get(String name, Output<String> id, VnicState state, CustomResourceOptions options)Resource lookup is not supported in YAML- name
 - The unique name of the resulting resource.
 - id
 - The unique provider ID of the resource to lookup.
 - state
 - Any extra arguments used during the lookup.
 - opts
 - A bag of options that control this resource's behavior.
 
- resource_name
 - The unique name of the resulting resource.
 - id
 - The unique provider ID of the resource to lookup.
 
- name
 - The unique name of the resulting resource.
 - id
 - The unique provider ID of the resource to lookup.
 - state
 - Any extra arguments used during the lookup.
 - opts
 - A bag of options that control this resource's behavior.
 
- name
 - The unique name of the resulting resource.
 - id
 - The unique provider ID of the resource to lookup.
 - state
 - Any extra arguments used during the lookup.
 - opts
 - A bag of options that control this resource's behavior.
 
- name
 - The unique name of the resulting resource.
 - id
 - The unique provider ID of the resource to lookup.
 - state
 - Any extra arguments used during the lookup.
 - opts
 - A bag of options that control this resource's behavior.
 
- Distributed
Port stringGroup  - Key of the distributed portgroup the nic will connect to.
 - Distributed
Switch stringPort  - UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
 - Host string
 - ESX host the interface belongs to
 - Ipv4
Pulumi.
VSphere. Inputs. Vnic Ipv4  - IPv4 settings. Either this or 
ipv6needs to be set. See IPv4 options below. - Ipv6
Pulumi.
VSphere. Inputs. Vnic Ipv6  - IPv6 settings. Either this or 
ipv6needs to be set. See IPv6 options below. - Mac string
 - MAC address of the interface.
 - Mtu int
 - MTU of the interface.
 - Netstack string
 - TCP/IP stack setting for this interface. Possible values are 
defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:defaultTcpipStack`) - Portgroup string
 - Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
 - Services List<string>
 - Enabled services setting for this interface. Currently support values are 
vmotion,management, andvsan. 
- Distributed
Port stringGroup  - Key of the distributed portgroup the nic will connect to.
 - Distributed
Switch stringPort  - UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
 - Host string
 - ESX host the interface belongs to
 - Ipv4
Vnic
Ipv4Args  - IPv4 settings. Either this or 
ipv6needs to be set. See IPv4 options below. - Ipv6
Vnic
Ipv6Args  - IPv6 settings. Either this or 
ipv6needs to be set. See IPv6 options below. - Mac string
 - MAC address of the interface.
 - Mtu int
 - MTU of the interface.
 - Netstack string
 - TCP/IP stack setting for this interface. Possible values are 
defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:defaultTcpipStack`) - Portgroup string
 - Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
 - Services []string
 - Enabled services setting for this interface. Currently support values are 
vmotion,management, andvsan. 
- distributed
Port StringGroup  - Key of the distributed portgroup the nic will connect to.
 - distributed
Switch StringPort  - UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
 - host String
 - ESX host the interface belongs to
 - ipv4
Vnic
Ipv4  - IPv4 settings. Either this or 
ipv6needs to be set. See IPv4 options below. - ipv6
Vnic
Ipv6  - IPv6 settings. Either this or 
ipv6needs to be set. See IPv6 options below. - mac String
 - MAC address of the interface.
 - mtu Integer
 - MTU of the interface.
 - netstack String
 - TCP/IP stack setting for this interface. Possible values are 
defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:defaultTcpipStack`) - portgroup String
 - Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
 - services List<String>
 - Enabled services setting for this interface. Currently support values are 
vmotion,management, andvsan. 
- distributed
Port stringGroup  - Key of the distributed portgroup the nic will connect to.
 - distributed
Switch stringPort  - UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
 - host string
 - ESX host the interface belongs to
 - ipv4
Vnic
Ipv4  - IPv4 settings. Either this or 
ipv6needs to be set. See IPv4 options below. - ipv6
Vnic
Ipv6  - IPv6 settings. Either this or 
ipv6needs to be set. See IPv6 options below. - mac string
 - MAC address of the interface.
 - mtu number
 - MTU of the interface.
 - netstack string
 - TCP/IP stack setting for this interface. Possible values are 
defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:defaultTcpipStack`) - portgroup string
 - Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
 - services string[]
 - Enabled services setting for this interface. Currently support values are 
vmotion,management, andvsan. 
- distributed_
port_ strgroup  - Key of the distributed portgroup the nic will connect to.
 - distributed_
switch_ strport  - UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
 - host str
 - ESX host the interface belongs to
 - ipv4
Vnic
Ipv4Args  - IPv4 settings. Either this or 
ipv6needs to be set. See IPv4 options below. - ipv6
Vnic
Ipv6Args  - IPv6 settings. Either this or 
ipv6needs to be set. See IPv6 options below. - mac str
 - MAC address of the interface.
 - mtu int
 - MTU of the interface.
 - netstack str
 - TCP/IP stack setting for this interface. Possible values are 
defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:defaultTcpipStack`) - portgroup str
 - Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
 - services Sequence[str]
 - Enabled services setting for this interface. Currently support values are 
vmotion,management, andvsan. 
- distributed
Port StringGroup  - Key of the distributed portgroup the nic will connect to.
 - distributed
Switch StringPort  - UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
 - host String
 - ESX host the interface belongs to
 - ipv4 Property Map
 - IPv4 settings. Either this or 
ipv6needs to be set. See IPv4 options below. - ipv6 Property Map
 - IPv6 settings. Either this or 
ipv6needs to be set. See IPv6 options below. - mac String
 - MAC address of the interface.
 - mtu Number
 - MTU of the interface.
 - netstack String
 - TCP/IP stack setting for this interface. Possible values are 
defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:defaultTcpipStack`) - portgroup String
 - Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
 - services List<String>
 - Enabled services setting for this interface. Currently support values are 
vmotion,management, andvsan. 
Supporting Types
VnicIpv4, VnicIpv4Args    
VnicIpv6, VnicIpv6Args    
- Addresses List<string>
 - List of IPv6 addresses
 - Autoconfig bool
 - Use IPv6 Autoconfiguration (RFC2462).
 - Dhcp bool
 - Use DHCP to configure the interface's IPv4 stack.
 - Gw string
 - IP address of the default gateway, if DHCP or autoconfig is not set.
 
- Addresses []string
 - List of IPv6 addresses
 - Autoconfig bool
 - Use IPv6 Autoconfiguration (RFC2462).
 - Dhcp bool
 - Use DHCP to configure the interface's IPv4 stack.
 - Gw string
 - IP address of the default gateway, if DHCP or autoconfig is not set.
 
- addresses List<String>
 - List of IPv6 addresses
 - autoconfig Boolean
 - Use IPv6 Autoconfiguration (RFC2462).
 - dhcp Boolean
 - Use DHCP to configure the interface's IPv4 stack.
 - gw String
 - IP address of the default gateway, if DHCP or autoconfig is not set.
 
- addresses string[]
 - List of IPv6 addresses
 - autoconfig boolean
 - Use IPv6 Autoconfiguration (RFC2462).
 - dhcp boolean
 - Use DHCP to configure the interface's IPv4 stack.
 - gw string
 - IP address of the default gateway, if DHCP or autoconfig is not set.
 
- addresses Sequence[str]
 - List of IPv6 addresses
 - autoconfig bool
 - Use IPv6 Autoconfiguration (RFC2462).
 - dhcp bool
 - Use DHCP to configure the interface's IPv4 stack.
 - gw str
 - IP address of the default gateway, if DHCP or autoconfig is not set.
 
- addresses List<String>
 - List of IPv6 addresses
 - autoconfig Boolean
 - Use IPv6 Autoconfiguration (RFC2462).
 - dhcp Boolean
 - Use DHCP to configure the interface's IPv4 stack.
 - gw String
 - IP address of the default gateway, if DHCP or autoconfig is not set.
 
Import
ing
An existing vNic can be imported into this resource via supplying the vNic’s ID. An example is below:
terraform import vsphere_vnic.v1 host-123_vmk2
The above would import the vnic vmk2 from host with ID host-123.
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
 - vSphere pulumi/pulumi-vsphere
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
vsphereTerraform Provider.