Show / Hide Table of Contents

Class HostPortGroup

The vsphere..HostPortGroup resource can be used to manage vSphere standard port groups on an ESXi host. These port groups are connected to standard virtual switches, which can be managed by the vsphere..HostVirtualSwitch resource.

For an overview on vSphere networking concepts, see this page.

Example Usage

Create a virtual switch and bind a port group to it

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
public MyStack()
{
    var datacenter = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
    {
        Name = "dc1",
    }));
    var esxiHost = datacenter.Apply(datacenter => Output.Create(VSphere.GetHost.InvokeAsync(new VSphere.GetHostArgs
    {
        DatacenterId = datacenter.Id,
        Name = "esxi1",
    })));
    var @switch = new VSphere.HostVirtualSwitch("switch", new VSphere.HostVirtualSwitchArgs
    {
        ActiveNics = 
        {
            "vmnic0",
        },
        HostSystemId = esxiHost.Apply(esxiHost => esxiHost.Id),
        NetworkAdapters = 
        {
            "vmnic0",
            "vmnic1",
        },
        StandbyNics = 
        {
            "vmnic1",
        },
    });
    var pg = new VSphere.HostPortGroup("pg", new VSphere.HostPortGroupArgs
    {
        HostSystemId = esxiHost.Apply(esxiHost => esxiHost.Id),
        VirtualSwitchName = @switch.Name,
    });
}

}

Create a port group with VLAN set and some overrides

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
public MyStack()
{
    var datacenter = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
    {
        Name = "dc1",
    }));
    var esxiHost = datacenter.Apply(datacenter => Output.Create(VSphere.GetHost.InvokeAsync(new VSphere.GetHostArgs
    {
        DatacenterId = datacenter.Id,
        Name = "esxi1",
    })));
    var @switch = new VSphere.HostVirtualSwitch("switch", new VSphere.HostVirtualSwitchArgs
    {
        ActiveNics = 
        {
            "vmnic0",
        },
        HostSystemId = esxiHost.Apply(esxiHost => esxiHost.Id),
        NetworkAdapters = 
        {
            "vmnic0",
            "vmnic1",
        },
        StandbyNics = 
        {
            "vmnic1",
        },
    });
    var pg = new VSphere.HostPortGroup("pg", new VSphere.HostPortGroupArgs
    {
        AllowPromiscuous = true,
        HostSystemId = esxiHost.Apply(esxiHost => esxiHost.Id),
        VirtualSwitchName = @switch.Name,
        VlanId = 4095,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
HostPortGroup
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 HostPortGroup : CustomResource

Constructors

View Source

HostPortGroup(String, HostPortGroupArgs, CustomResourceOptions)

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

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

The unique name of the resource

HostPortGroupArgs 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

ActiveNics

List of active network adapters used for load balancing.

Declaration
public Output<ImmutableArray<string>> ActiveNics { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

AllowForgedTransmits

Controls whether or not the virtual network adapter is allowed to send network traffic with a different MAC address than that of its own.

Declaration
public Output<bool?> AllowForgedTransmits { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

AllowMacChanges

Controls whether or not the Media Access Control (MAC) address can be changed.

Declaration
public Output<bool?> AllowMacChanges { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

AllowPromiscuous

Enable promiscuous mode on the network. This flag indicates whether or not all traffic is seen on a given port.

Declaration
public Output<bool?> AllowPromiscuous { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

CheckBeacon

Enable beacon probing. Requires that the vSwitch has been configured to use a beacon. If disabled, link status is used only.

Declaration
public Output<bool?> CheckBeacon { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

ComputedPolicy

A map with a full set of the policy options computed from defaults and overrides, explaining the effective policy for this port group.

Declaration
public Output<ImmutableDictionary<string, string>> ComputedPolicy { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>>
View Source

Failback

If true, the teaming policy will re-activate failed interfaces higher in precedence when they come back up.

Declaration
public Output<bool?> Failback { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

HostSystemId

The managed object ID of the host to set the port group up on. Forces a new resource if changed.

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

Key

The key for this port group as returned from the vSphere API.

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

Name

The name of the port group. Forces a new resource if changed.

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

NotifySwitches

If true, the teaming policy will notify the broadcast network of a NIC failover, triggering cache updates.

Declaration
public Output<bool?> NotifySwitches { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

Ports

A list of ports that currently exist and are used on this port group.

Declaration
public Output<HostPortGroupPorts> Ports { get; }
Property Value
Type Description
Output<HostPortGroupPorts>
View Source

ShapingAverageBandwidth

The average bandwidth in bits per second if traffic shaping is enabled.

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

ShapingBurstSize

The maximum burst size allowed in bytes if traffic shaping is enabled.

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

ShapingEnabled

Enable traffic shaping on this virtual switch or port group.

Declaration
public Output<bool?> ShapingEnabled { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

ShapingPeakBandwidth

The peak bandwidth during bursts in bits per second if traffic shaping is enabled.

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

StandbyNics

List of standby network adapters used for failover.

Declaration
public Output<ImmutableArray<string>> StandbyNics { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

TeamingPolicy

The network adapter teaming policy. Can be one of loadbalance_ip, loadbalance_srcmac, loadbalance_srcid, or failover_explicit.

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

VirtualSwitchName

The name of the virtual switch to bind this port group to. Forces a new resource if changed.

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

VlanId

The VLAN ID/trunk mode for this port group. An ID of 0 denotes no tagging, an ID of 1-4094 tags with the specific ID, and an ID of 4095 enables trunk mode, allowing the guest to manage its own tagging. Default: 0.

Declaration
public Output<int?> VlanId { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>

Methods

View Source

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

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

Declaration
public static HostPortGroup Get(string name, Input<string> id, HostPortGroupState 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.

HostPortGroupState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

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