Vnic
Provides a VMware vSphere vnic resource.
Example Usages
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,
},
});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={
"dhcp": True,
})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:
import * as pulumi from "@pulumi/pulumi";import pulumiusing Pulumi;
class MyStack : Stack
{
public MyStack()
{
}
}
The above would import the the vnic vmk2 from host with ID host-123.
Create a Vnic Resource
new Vnic(name: string, args: VnicArgs, opts?: CustomResourceOptions);def Vnic(resource_name, opts=None, distributed_port_group=None, distributed_switch_port=None, host=None, ipv4=None, ipv6=None, mac=None, mtu=None, netstack=None, portgroup=None, __props__=None);public Vnic(string name, VnicArgs args, CustomResourceOptions? opts = null)- 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.
- opts ResourceOptions
- A bag of options that control this 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.
Vnic Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model 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 Ipv4Args IPv4 settings. Either this or
ipv6needs to be set. See ipv4 options below.- Ipv6
Pulumi.
VSphere. Inputs. 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.
- 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 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.
- 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.
- 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
Dict[Vnic
Ipv4] IPv4 settings. Either this or
ipv6needs to be set. See ipv4 options below.- ipv6
Dict[Vnic
Ipv6] IPv6 settings. Either this or
ipv6needs to be set. See ipv6 options below.- mac str
MAC address of the interface.
- mtu float
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.
Outputs
All input properties are implicitly available as output properties. Additionally, the Vnic resource produces the following output properties:
Look up an 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): Vnicstatic get(resource_name, id, opts=None, distributed_port_group=None, distributed_switch_port=None, host=None, ipv4=None, ipv6=None, mac=None, mtu=None, netstack=None, portgroup=None, __props__=None);public static Vnic Get(string name, Input<string> id, VnicState? state, CustomResourceOptions? opts = null)- 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.
The following state arguments are supported:
- 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 Ipv4Args IPv4 settings. Either this or
ipv6needs to be set. See ipv4 options below.- Ipv6
Pulumi.
VSphere. Inputs. 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.
- 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 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.
- 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.
- 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
Dict[Vnic
Ipv4] IPv4 settings. Either this or
ipv6needs to be set. See ipv4 options below.- ipv6
Dict[Vnic
Ipv6] IPv6 settings. Either this or
ipv6needs to be set. See ipv6 options below.- mac str
MAC address of the interface.
- mtu float
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.
Supporting Types
VnicIpv4
VnicIpv6
- 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.
Package Details
- Repository
- https://github.com/pulumi/pulumi-vsphere
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
vsphereTerraform Provider.