1. Packages
  2. vSphere
  3. API Docs
  4. Vnic
vSphere v4.10.0 published on Tuesday, Mar 12, 2024 by Pulumi

vsphere.Vnic

Explore with Pulumi AI

vsphere logo
vSphere v4.10.0 published on Tuesday, Mar 12, 2024 by Pulumi

    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", {
        datacenterId: dc.then(dc => dc.id),
        hosts: [{
            hostSystemId: h1.then(h1 => h1.id),
            devices: ["vnic3"],
        }],
    });
    const p1 = new vsphere.DistributedPortGroup("p1", {
        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",
        datacenter_id=dc.id,
        hosts=[vsphere.DistributedVirtualSwitchHostArgs(
            host_system_id=h1.id,
            devices=["vnic3"],
        )])
    p1 = vsphere.DistributedPortGroup("p1",
        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{
    			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{
    			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()
        {
            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()
        {
            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()        
                .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()        
                .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:
          datacenterId: ${dc.id}
          hosts:
            - hostSystemId: ${h1.id}
              devices:
                - vnic3
      p1:
        type: vsphere:DistributedPortGroup
        properties:
          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", {
        hostSystemId: h1.then(h1 => h1.id),
        networkAdapters: [
            "vmnic3",
            "vmnic4",
        ],
        activeNics: ["vmnic3"],
        standbyNics: ["vmnic4"],
    });
    const p1 = new vsphere.HostPortGroup("p1", {
        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",
        host_system_id=h1.id,
        network_adapters=[
            "vmnic3",
            "vmnic4",
        ],
        active_nics=["vmnic3"],
        standby_nics=["vmnic4"])
    p1 = vsphere.HostPortGroup("p1",
        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{
    			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{
    			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()
        {
            HostSystemId = h1.Apply(getHostResult => getHostResult.Id),
            NetworkAdapters = new[]
            {
                "vmnic3",
                "vmnic4",
            },
            ActiveNics = new[]
            {
                "vmnic3",
            },
            StandbyNics = new[]
            {
                "vmnic4",
            },
        });
    
        var p1 = new VSphere.HostPortGroup("p1", new()
        {
            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()        
                .hostSystemId(h1.applyValue(getHostResult -> getHostResult.id()))
                .networkAdapters(            
                    "vmnic3",
                    "vmnic4")
                .activeNics("vmnic3")
                .standbyNics("vmnic4")
                .build());
    
            var p1 = new HostPortGroup("p1", HostPortGroupArgs.builder()        
                .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:
          hostSystemId: ${h1.id}
          networkAdapters:
            - vmnic3
            - vmnic4
          activeNics:
            - vmnic3
          standbyNics:
            - vmnic4
      p1:
        type: vsphere:HostPortGroup
        properties:
          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

    new Vnic(name: string, args: VnicArgs, opts?: CustomResourceOptions);
    @overload
    def Vnic(resource_name: 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)
    @overload
    def Vnic(resource_name: str,
             args: VnicArgs,
             opts: Optional[ResourceOptions] = None)
    func NewVnic(ctx *Context, name string, args VnicArgs, opts ...ResourceOption) (*Vnic, error)
    public Vnic(string name, VnicArgs args, CustomResourceOptions? opts = null)
    public Vnic(String name, VnicArgs args)
    public Vnic(String name, VnicArgs args, CustomResourceOptions options)
    
    type: vsphere:Vnic
    properties: # The arguments to resource properties.
    options: # 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.
    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.

    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
    DistributedPortGroup string
    Key of the distributed portgroup the nic will connect to.
    DistributedSwitchPort string
    UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
    Ipv4 Pulumi.VSphere.Inputs.VnicIpv4
    IPv4 settings. Either this or ipv6 needs to be set. See IPv4 options below.
    Ipv6 Pulumi.VSphere.Inputs.VnicIpv6
    IPv6 settings. Either this or ipv6 needs 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, and vsan.
    Host string
    ESX host the interface belongs to
    DistributedPortGroup string
    Key of the distributed portgroup the nic will connect to.
    DistributedSwitchPort string
    UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
    Ipv4 VnicIpv4Args
    IPv4 settings. Either this or ipv6 needs to be set. See IPv4 options below.
    Ipv6 VnicIpv6Args
    IPv6 settings. Either this or ipv6 needs 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, and vsan.
    host String
    ESX host the interface belongs to
    distributedPortGroup String
    Key of the distributed portgroup the nic will connect to.
    distributedSwitchPort String
    UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
    ipv4 VnicIpv4
    IPv4 settings. Either this or ipv6 needs to be set. See IPv4 options below.
    ipv6 VnicIpv6
    IPv6 settings. Either this or ipv6 needs 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, and vsan.
    host string
    ESX host the interface belongs to
    distributedPortGroup string
    Key of the distributed portgroup the nic will connect to.
    distributedSwitchPort string
    UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
    ipv4 VnicIpv4
    IPv4 settings. Either this or ipv6 needs to be set. See IPv4 options below.
    ipv6 VnicIpv6
    IPv6 settings. Either this or ipv6 needs 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, and vsan.
    host str
    ESX host the interface belongs to
    distributed_port_group str
    Key of the distributed portgroup the nic will connect to.
    distributed_switch_port str
    UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.
    ipv4 VnicIpv4Args
    IPv4 settings. Either this or ipv6 needs to be set. See IPv4 options below.
    ipv6 VnicIpv6Args
    IPv6 settings. Either this or ipv6 needs 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, and vsan.
    host String
    ESX host the interface belongs to
    distributedPortGroup String
    Key of the distributed portgroup the nic will connect to.
    distributedSwitchPort String
    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 ipv6 needs to be set. See IPv4 options below.
    ipv6 Property Map
    IPv6 settings. Either this or ipv6 needs 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, and vsan.

    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) -> Vnic
    func 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.
    The following state arguments are supported:
    DistributedPortGroup string
    Key of the distributed portgroup the nic will connect to.
    DistributedSwitchPort string
    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.VnicIpv4
    IPv4 settings. Either this or ipv6 needs to be set. See IPv4 options below.
    Ipv6 Pulumi.VSphere.Inputs.VnicIpv6
    IPv6 settings. Either this or ipv6 needs 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, and vsan.
    DistributedPortGroup string
    Key of the distributed portgroup the nic will connect to.
    DistributedSwitchPort string
    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 VnicIpv4Args
    IPv4 settings. Either this or ipv6 needs to be set. See IPv4 options below.
    Ipv6 VnicIpv6Args
    IPv6 settings. Either this or ipv6 needs 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, and vsan.
    distributedPortGroup String
    Key of the distributed portgroup the nic will connect to.
    distributedSwitchPort String
    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 VnicIpv4
    IPv4 settings. Either this or ipv6 needs to be set. See IPv4 options below.
    ipv6 VnicIpv6
    IPv6 settings. Either this or ipv6 needs 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, and vsan.
    distributedPortGroup string
    Key of the distributed portgroup the nic will connect to.
    distributedSwitchPort string
    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 VnicIpv4
    IPv4 settings. Either this or ipv6 needs to be set. See IPv4 options below.
    ipv6 VnicIpv6
    IPv6 settings. Either this or ipv6 needs 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, and vsan.
    distributed_port_group str
    Key of the distributed portgroup the nic will connect to.
    distributed_switch_port str
    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 VnicIpv4Args
    IPv4 settings. Either this or ipv6 needs to be set. See IPv4 options below.
    ipv6 VnicIpv6Args
    IPv6 settings. Either this or ipv6 needs 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, and vsan.
    distributedPortGroup String
    Key of the distributed portgroup the nic will connect to.
    distributedSwitchPort String
    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 ipv6 needs to be set. See IPv4 options below.
    ipv6 Property Map
    IPv6 settings. Either this or ipv6 needs 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, and vsan.

    Supporting Types

    VnicIpv4, VnicIpv4Args

    Dhcp bool
    Use DHCP to configure the interface's IPv6 stack.
    Gw string
    IP address of the default gateway, if DHCP or autoconfig is not set.
    Ip string
    Address of the interface, if DHCP is not set.
    Netmask string
    Netmask of the interface, if DHCP is not set.
    Dhcp bool
    Use DHCP to configure the interface's IPv6 stack.
    Gw string
    IP address of the default gateway, if DHCP or autoconfig is not set.
    Ip string
    Address of the interface, if DHCP is not set.
    Netmask string
    Netmask of the interface, if DHCP is not set.
    dhcp Boolean
    Use DHCP to configure the interface's IPv6 stack.
    gw String
    IP address of the default gateway, if DHCP or autoconfig is not set.
    ip String
    Address of the interface, if DHCP is not set.
    netmask String
    Netmask of the interface, if DHCP is not set.
    dhcp boolean
    Use DHCP to configure the interface's IPv6 stack.
    gw string
    IP address of the default gateway, if DHCP or autoconfig is not set.
    ip string
    Address of the interface, if DHCP is not set.
    netmask string
    Netmask of the interface, if DHCP is not set.
    dhcp bool
    Use DHCP to configure the interface's IPv6 stack.
    gw str
    IP address of the default gateway, if DHCP or autoconfig is not set.
    ip str
    Address of the interface, if DHCP is not set.
    netmask str
    Netmask of the interface, if DHCP is not set.
    dhcp Boolean
    Use DHCP to configure the interface's IPv6 stack.
    gw String
    IP address of the default gateway, if DHCP or autoconfig is not set.
    ip String
    Address of the interface, if DHCP is not set.
    netmask String
    Netmask of the interface, if DHCP is not set.

    VnicIpv6, VnicIpv6Args

    Addresses List<string>
    List of IPv6 addresses
    Autoconfig bool
    Use IPv6 Autoconfiguration (RFC2462).
    Dhcp bool
    Use DHCP to configure the interface's IPv6 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 IPv6 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 IPv6 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 IPv6 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 IPv6 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 IPv6 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:

    import * as pulumi from "@pulumi/pulumi";
    
    import pulumi
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    
    return await Deployment.RunAsync(() => 
    {
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    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) {
        }
    }
    
    {}
    

    The above would import the vnic vmk2 from host with ID host-123.

    Package Details

    Repository
    vSphere pulumi/pulumi-vsphere
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vsphere Terraform Provider.
    vsphere logo
    vSphere v4.10.0 published on Tuesday, Mar 12, 2024 by Pulumi