Show / Hide Table of Contents

Class PortVlanAttachment

Provides a resource to attach device ports to VLANs.

Device and VLAN must be in the same facility.

If you need this resource to add the port back to bond on removal, set force_bond = true.

To learn more about Layer 2 networking in Packet, refer to

  • https://www.packet.com/resources/guides/layer-2-configurations/
  • https://www.packet.com/developers/docs/network/advanced/layer-2/

Example Usage

using Pulumi;
using Packet = Pulumi.Packet;

class MyStack : Stack
{
public MyStack()
{
    // Hybrid network type
    var testVlan = new Packet.Vlan("testVlan", new Packet.VlanArgs
    {
        Description = "VLAN in New Jersey",
        Facility = "ewr1",
        ProjectId = local.Project_id,
    });
    var testDevice = new Packet.Device("testDevice", new Packet.DeviceArgs
    {
        Hostname = "test",
        Plan = "m1.xlarge.x86",
        Facilities = 
        {
            "ewr1",
        },
        OperatingSystem = "ubuntu_16_04",
        BillingCycle = "hourly",
        ProjectId = local.Project_id,
        NetworkType = "hybrid",
    });
    var testPortVlanAttachment = new Packet.PortVlanAttachment("testPortVlanAttachment", new Packet.PortVlanAttachmentArgs
    {
        DeviceId = testDevice.Id,
        PortName = "eth1",
        VlanVnid = testVlan.Vxlan,
    });
    // Layer 2 network
    var testIndex_deviceDevice = new Packet.Device("testIndex/deviceDevice", new Packet.DeviceArgs
    {
        Hostname = "test",
        Plan = "m1.xlarge.x86",
        Facilities = 
        {
            "ewr1",
        },
        OperatingSystem = "ubuntu_16_04",
        BillingCycle = "hourly",
        ProjectId = local.Project_id,
        NetworkType = "layer2-individual",
    });
    var test1Vlan = new Packet.Vlan("test1Vlan", new Packet.VlanArgs
    {
        Description = "VLAN in New Jersey",
        Facility = "ewr1",
        ProjectId = local.Project_id,
    });
    var test2Vlan = new Packet.Vlan("test2Vlan", new Packet.VlanArgs
    {
        Description = "VLAN in New Jersey",
        Facility = "ewr1",
        ProjectId = local.Project_id,
    });
    var test1PortVlanAttachment = new Packet.PortVlanAttachment("test1PortVlanAttachment", new Packet.PortVlanAttachmentArgs
    {
        DeviceId = testDevice.Id,
        VlanVnid = test1Vlan.Vxlan,
        PortName = "eth1",
    });
    var test2PortVlanAttachment = new Packet.PortVlanAttachment("test2PortVlanAttachment", new Packet.PortVlanAttachmentArgs
    {
        DeviceId = testDevice.Id,
        VlanVnid = test2Vlan.Vxlan,
        PortName = "eth1",
        Native = true,
    });
}

}

Attribute Referece

  • id - UUID of device port used in the assignment
  • vlan_id - UUID of VLAN API resource
  • port_id - UUID of device port
Inheritance
System.Object
Resource
CustomResource
PortVlanAttachment
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.Packet
Assembly: Pulumi.Packet.dll
Syntax
public class PortVlanAttachment : CustomResource

Constructors

View Source

PortVlanAttachment(String, PortVlanAttachmentArgs, CustomResourceOptions)

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

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

The unique name of the resource

PortVlanAttachmentArgs 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

DeviceId

ID of device to be assigned to the VLAN

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

ForceBond

Add port back to the bond when this resource is removed. Default is false.

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

Native

Mark this VLAN a native VLAN on the port. This can be used only if this assignment assigns second or further VLAN to the port. To ensure that this attachment is not first on a port, you can use depends_on pointing to another packet_port_vlan_attachment, just like in the layer2-individual example above.

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

PortId

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

PortName

Name of network port to be assigned to the VLAN

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

VlanId

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

VlanVnid

VXLAN Network Identifier, integer

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

Methods

View Source

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

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

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

PortVlanAttachmentState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

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