1. Packages
  2. vSphere
  3. API Docs
  4. Vnic
vSphere v4.11.2 published on Tuesday, Sep 17, 2024 by Pulumi

vsphere.Vnic

Explore with Pulumi AI

vsphere logo
vSphere v4.11.2 published on Tuesday, Sep 17, 2024 by Pulumi

    Provides a VMware vSphere vnic resource.

    Example Usage

    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 datacenter = vsphere.getDatacenter({
        name: "dc-01",
    });
    const host = datacenter.then(datacenter => vsphere.getHost({
        name: "esxi-01.example.com",
        datacenterId: datacenter.id,
    }));
    const vds = new vsphere.DistributedVirtualSwitch("vds", {
        name: "vds-01",
        datacenterId: datacenter.then(datacenter => datacenter.id),
        hosts: [{
            hostSystemId: host.then(host => host.id),
            devices: ["vnic3"],
        }],
    });
    const pg = new vsphere.DistributedPortGroup("pg", {
        name: "pg-01",
        vlanId: 1234,
        distributedVirtualSwitchUuid: vds.id,
    });
    const vnic = new vsphere.Vnic("vnic", {
        host: host.then(host => host.id),
        distributedSwitchPort: vds.id,
        distributedPortGroup: pg.id,
        ipv4: {
            dhcp: true,
        },
        netstack: "vmotion",
    });
    
    import pulumi
    import pulumi_vsphere as vsphere
    
    datacenter = vsphere.get_datacenter(name="dc-01")
    host = vsphere.get_host(name="esxi-01.example.com",
        datacenter_id=datacenter.id)
    vds = vsphere.DistributedVirtualSwitch("vds",
        name="vds-01",
        datacenter_id=datacenter.id,
        hosts=[{
            "host_system_id": host.id,
            "devices": ["vnic3"],
        }])
    pg = vsphere.DistributedPortGroup("pg",
        name="pg-01",
        vlan_id=1234,
        distributed_virtual_switch_uuid=vds.id)
    vnic = vsphere.Vnic("vnic",
        host=host.id,
        distributed_switch_port=vds.id,
        distributed_port_group=pg.id,
        ipv4={
            "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 {
    		datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{
    			Name: pulumi.StringRef("dc-01"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		host, err := vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{
    			Name:         pulumi.StringRef("esxi-01.example.com"),
    			DatacenterId: datacenter.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		vds, err := vsphere.NewDistributedVirtualSwitch(ctx, "vds", &vsphere.DistributedVirtualSwitchArgs{
    			Name:         pulumi.String("vds-01"),
    			DatacenterId: pulumi.String(datacenter.Id),
    			Hosts: vsphere.DistributedVirtualSwitchHostArray{
    				&vsphere.DistributedVirtualSwitchHostArgs{
    					HostSystemId: pulumi.String(host.Id),
    					Devices: pulumi.StringArray{
    						pulumi.String("vnic3"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		pg, err := vsphere.NewDistributedPortGroup(ctx, "pg", &vsphere.DistributedPortGroupArgs{
    			Name:                         pulumi.String("pg-01"),
    			VlanId:                       pulumi.Int(1234),
    			DistributedVirtualSwitchUuid: vds.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = vsphere.NewVnic(ctx, "vnic", &vsphere.VnicArgs{
    			Host:                  pulumi.String(host.Id),
    			DistributedSwitchPort: vds.ID(),
    			DistributedPortGroup:  pg.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 datacenter = VSphere.GetDatacenter.Invoke(new()
        {
            Name = "dc-01",
        });
    
        var host = VSphere.GetHost.Invoke(new()
        {
            Name = "esxi-01.example.com",
            DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
        });
    
        var vds = new VSphere.DistributedVirtualSwitch("vds", new()
        {
            Name = "vds-01",
            DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
            Hosts = new[]
            {
                new VSphere.Inputs.DistributedVirtualSwitchHostArgs
                {
                    HostSystemId = host.Apply(getHostResult => getHostResult.Id),
                    Devices = new[]
                    {
                        "vnic3",
                    },
                },
            },
        });
    
        var pg = new VSphere.DistributedPortGroup("pg", new()
        {
            Name = "pg-01",
            VlanId = 1234,
            DistributedVirtualSwitchUuid = vds.Id,
        });
    
        var vnic = new VSphere.Vnic("vnic", new()
        {
            Host = host.Apply(getHostResult => getHostResult.Id),
            DistributedSwitchPort = vds.Id,
            DistributedPortGroup = pg.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 datacenter = VsphereFunctions.getDatacenter(GetDatacenterArgs.builder()
                .name("dc-01")
                .build());
    
            final var host = VsphereFunctions.getHost(GetHostArgs.builder()
                .name("esxi-01.example.com")
                .datacenterId(datacenter.applyValue(getDatacenterResult -> getDatacenterResult.id()))
                .build());
    
            var vds = new DistributedVirtualSwitch("vds", DistributedVirtualSwitchArgs.builder()
                .name("vds-01")
                .datacenterId(datacenter.applyValue(getDatacenterResult -> getDatacenterResult.id()))
                .hosts(DistributedVirtualSwitchHostArgs.builder()
                    .hostSystemId(host.applyValue(getHostResult -> getHostResult.id()))
                    .devices("vnic3")
                    .build())
                .build());
    
            var pg = new DistributedPortGroup("pg", DistributedPortGroupArgs.builder()
                .name("pg-01")
                .vlanId(1234)
                .distributedVirtualSwitchUuid(vds.id())
                .build());
    
            var vnic = new Vnic("vnic", VnicArgs.builder()
                .host(host.applyValue(getHostResult -> getHostResult.id()))
                .distributedSwitchPort(vds.id())
                .distributedPortGroup(pg.id())
                .ipv4(VnicIpv4Args.builder()
                    .dhcp(true)
                    .build())
                .netstack("vmotion")
                .build());
    
        }
    }
    
    resources:
      vds:
        type: vsphere:DistributedVirtualSwitch
        properties:
          name: vds-01
          datacenterId: ${datacenter.id}
          hosts:
            - hostSystemId: ${host.id}
              devices:
                - vnic3
      pg:
        type: vsphere:DistributedPortGroup
        properties:
          name: pg-01
          vlanId: 1234
          distributedVirtualSwitchUuid: ${vds.id}
      vnic:
        type: vsphere:Vnic
        properties:
          host: ${host.id}
          distributedSwitchPort: ${vds.id}
          distributedPortGroup: ${pg.id}
          ipv4:
            dhcp: true
          netstack: vmotion
    variables:
      datacenter:
        fn::invoke:
          Function: vsphere:getDatacenter
          Arguments:
            name: dc-01
      host:
        fn::invoke:
          Function: vsphere:getHost
          Arguments:
            name: esxi-01.example.com
            datacenterId: ${datacenter.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 datacenter = vsphere.getDatacenter({
        name: "dc-01",
    });
    const host = datacenter.then(datacenter => vsphere.getHost({
        name: "esxi-01.example.com",
        datacenterId: datacenter.id,
    }));
    const hvs = new vsphere.HostVirtualSwitch("hvs", {
        name: "hvs-01",
        hostSystemId: host.then(host => host.id),
        networkAdapters: [
            "vmnic3",
            "vmnic4",
        ],
        activeNics: ["vmnic3"],
        standbyNics: ["vmnic4"],
    });
    const pg = new vsphere.HostPortGroup("pg", {
        name: "pg-01",
        virtualSwitchName: hvs.name,
        hostSystemId: host.then(host => host.id),
    });
    const vnic = new vsphere.Vnic("vnic", {
        host: host.then(host => host.id),
        portgroup: pg.name,
        ipv4: {
            dhcp: true,
        },
        services: [
            "vsan",
            "management",
        ],
    });
    
    import pulumi
    import pulumi_vsphere as vsphere
    
    datacenter = vsphere.get_datacenter(name="dc-01")
    host = vsphere.get_host(name="esxi-01.example.com",
        datacenter_id=datacenter.id)
    hvs = vsphere.HostVirtualSwitch("hvs",
        name="hvs-01",
        host_system_id=host.id,
        network_adapters=[
            "vmnic3",
            "vmnic4",
        ],
        active_nics=["vmnic3"],
        standby_nics=["vmnic4"])
    pg = vsphere.HostPortGroup("pg",
        name="pg-01",
        virtual_switch_name=hvs.name,
        host_system_id=host.id)
    vnic = vsphere.Vnic("vnic",
        host=host.id,
        portgroup=pg.name,
        ipv4={
            "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 {
    		datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{
    			Name: pulumi.StringRef("dc-01"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		host, err := vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{
    			Name:         pulumi.StringRef("esxi-01.example.com"),
    			DatacenterId: datacenter.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		hvs, err := vsphere.NewHostVirtualSwitch(ctx, "hvs", &vsphere.HostVirtualSwitchArgs{
    			Name:         pulumi.String("hvs-01"),
    			HostSystemId: pulumi.String(host.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
    		}
    		pg, err := vsphere.NewHostPortGroup(ctx, "pg", &vsphere.HostPortGroupArgs{
    			Name:              pulumi.String("pg-01"),
    			VirtualSwitchName: hvs.Name,
    			HostSystemId:      pulumi.String(host.Id),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = vsphere.NewVnic(ctx, "vnic", &vsphere.VnicArgs{
    			Host:      pulumi.String(host.Id),
    			Portgroup: pg.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 datacenter = VSphere.GetDatacenter.Invoke(new()
        {
            Name = "dc-01",
        });
    
        var host = VSphere.GetHost.Invoke(new()
        {
            Name = "esxi-01.example.com",
            DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
        });
    
        var hvs = new VSphere.HostVirtualSwitch("hvs", new()
        {
            Name = "hvs-01",
            HostSystemId = host.Apply(getHostResult => getHostResult.Id),
            NetworkAdapters = new[]
            {
                "vmnic3",
                "vmnic4",
            },
            ActiveNics = new[]
            {
                "vmnic3",
            },
            StandbyNics = new[]
            {
                "vmnic4",
            },
        });
    
        var pg = new VSphere.HostPortGroup("pg", new()
        {
            Name = "pg-01",
            VirtualSwitchName = hvs.Name,
            HostSystemId = host.Apply(getHostResult => getHostResult.Id),
        });
    
        var vnic = new VSphere.Vnic("vnic", new()
        {
            Host = host.Apply(getHostResult => getHostResult.Id),
            Portgroup = pg.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 datacenter = VsphereFunctions.getDatacenter(GetDatacenterArgs.builder()
                .name("dc-01")
                .build());
    
            final var host = VsphereFunctions.getHost(GetHostArgs.builder()
                .name("esxi-01.example.com")
                .datacenterId(datacenter.applyValue(getDatacenterResult -> getDatacenterResult.id()))
                .build());
    
            var hvs = new HostVirtualSwitch("hvs", HostVirtualSwitchArgs.builder()
                .name("hvs-01")
                .hostSystemId(host.applyValue(getHostResult -> getHostResult.id()))
                .networkAdapters(            
                    "vmnic3",
                    "vmnic4")
                .activeNics("vmnic3")
                .standbyNics("vmnic4")
                .build());
    
            var pg = new HostPortGroup("pg", HostPortGroupArgs.builder()
                .name("pg-01")
                .virtualSwitchName(hvs.name())
                .hostSystemId(host.applyValue(getHostResult -> getHostResult.id()))
                .build());
    
            var vnic = new Vnic("vnic", VnicArgs.builder()
                .host(host.applyValue(getHostResult -> getHostResult.id()))
                .portgroup(pg.name())
                .ipv4(VnicIpv4Args.builder()
                    .dhcp(true)
                    .build())
                .services(            
                    "vsan",
                    "management")
                .build());
    
        }
    }
    
    resources:
      hvs:
        type: vsphere:HostVirtualSwitch
        properties:
          name: hvs-01
          hostSystemId: ${host.id}
          networkAdapters:
            - vmnic3
            - vmnic4
          activeNics:
            - vmnic3
          standbyNics:
            - vmnic4
      pg:
        type: vsphere:HostPortGroup
        properties:
          name: pg-01
          virtualSwitchName: ${hvs.name}
          hostSystemId: ${host.id}
      vnic:
        type: vsphere:Vnic
        properties:
          host: ${host.id}
          portgroup: ${pg.name}
          ipv4:
            dhcp: true
          services:
            - vsan
            - management
    variables:
      datacenter:
        fn::invoke:
          Function: vsphere:getDatacenter
          Arguments:
            name: dc-01
      host:
        fn::invoke:
          Function: vsphere:getHost
          Arguments:
            name: esxi-01.example.com
            datacenterId: ${datacenter.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)
    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.
    
    

    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
    DistributedPortGroup string
    Key of the distributed portgroup the nic will connect to.
    DistributedSwitchPort string
    UUID of the vdswitch 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 vdswitch 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 vdswitch 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 vdswitch 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 vdswitch 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 vdswitch 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 vdswitch 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 vdswitch 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 vdswitch 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 vdswitch 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 vdswitch 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 vdswitch 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 IPv4 stack.
    Gw string
    IP address of the default gateway, if DHCP 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 IPv4 stack.
    Gw string
    IP address of the default gateway, if DHCP 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 IPv4 stack.
    gw String
    IP address of the default gateway, if DHCP 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 IPv4 stack.
    gw string
    IP address of the default gateway, if DHCP 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 IPv4 stack.
    gw str
    IP address of the default gateway, if DHCP 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 IPv4 stack.
    gw String
    IP address of the default gateway, if DHCP 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 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.vnic 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 vsphere Terraform Provider.
    vsphere logo
    vSphere v4.11.2 published on Tuesday, Sep 17, 2024 by Pulumi