Show / Hide Table of Contents

Class Vnic

Provides a VMware vSphere vnic resource.

Example Usages

Create a vnic attached to a portgroup using the default TCP/IP stack

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
public MyStack()
{
    var dc = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
    {
        Name = "mydc",
    }));
    var h1 = dc.Apply(dc => Output.Create(VSphere.GetHost.InvokeAsync(new VSphere.GetHostArgs
    {
        Name = "esxi1.host.test",
        DatacenterId = dc.Id,
    })));
    var hvs1 = new VSphere.HostVirtualSwitch("hvs1", new VSphere.HostVirtualSwitchArgs
    {
        HostSystemId = h1.Apply(h1 => h1.Id),
        NetworkAdapters = 
        {
            "vmnic3",
            "vmnic4",
        },
        ActiveNics = 
        {
            "vmnic3",
        },
        StandbyNics = 
        {
            "vmnic4",
        },
    });
    var p1 = new VSphere.HostPortGroup("p1", new VSphere.HostPortGroupArgs
    {
        VirtualSwitchName = hvs1.Name,
        HostSystemId = h1.Apply(h1 => h1.Id),
    });
    var v1 = new VSphere.Vnic("v1", new VSphere.VnicArgs
    {
        Host = h1.Apply(h1 => h1.Id),
        Portgroup = p1.Name,
        Ipv4 = new VSphere.Inputs.VnicIpv4Args
        {
            Dhcp = true,
        },
    });
}

}

Importing

An existing vNic can be imported into this resource via supplying the vNic's ID. An example is below:

using Pulumi;

class MyStack : Stack
{
public MyStack()
{
}

}

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

Inheritance
System.Object
Resource
CustomResource
Vnic
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.VSphere
Assembly: Pulumi.VSphere.dll
Syntax
public class Vnic : CustomResource

Constructors

View Source

Vnic(String, VnicArgs, CustomResourceOptions)

Create a Vnic resource with the given unique name, arguments, and options.

Declaration
public Vnic(string name, VnicArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

VnicArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

DistributedPortGroup

Key of the distributed portgroup the nic will connect to.

Declaration
public Output<string> DistributedPortGroup { get; }
Property Value
Type Description
Output<System.String>
View Source

DistributedSwitchPort

UUID of the DVSwitch the nic will be attached to. Do not set if you set portgroup.

Declaration
public Output<string> DistributedSwitchPort { get; }
Property Value
Type Description
Output<System.String>
View Source

Host

ESX host the interface belongs to

Declaration
public Output<string> Host { get; }
Property Value
Type Description
Output<System.String>
View Source

Ipv4

IPv4 settings. Either this or ipv6 needs to be set. See ipv4 options below.

Declaration
public Output<VnicIpv4> Ipv4 { get; }
Property Value
Type Description
Output<VnicIpv4>
View Source

Ipv6

IPv6 settings. Either this or ipv6 needs to be set. See ipv6 options below.

Declaration
public Output<VnicIpv6> Ipv6 { get; }
Property Value
Type Description
Output<VnicIpv6>
View Source

Mac

MAC address of the interface.

Declaration
public Output<string> Mac { get; }
Property Value
Type Description
Output<System.String>
View Source

Mtu

MTU of the interface.

Declaration
public Output<int> Mtu { get; }
Property Value
Type Description
Output<System.Int32>
View Source

Netstack

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)

Declaration
public Output<string> Netstack { get; }
Property Value
Type Description
Output<System.String>
View Source

Portgroup

Portgroup to attach the nic to. Do not set if you set distributed_switch_port.

Declaration
public Output<string> Portgroup { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, VnicState, CustomResourceOptions)

Get an existing Vnic resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static Vnic Get(string name, Input<string> id, VnicState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

VnicState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
Vnic
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.