Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

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 Equinix Metal, refer to

Example Usage

Hybrid network type

using Pulumi;
using EquinixMetal = Pulumi.EquinixMetal;

class MyStack : Stack
{
    public MyStack()
    {
        var testVlan = new EquinixMetal.Vlan("testVlan", new EquinixMetal.VlanArgs
        {
            Description = "VLAN in New Jersey",
            Facility = "ewr1",
            ProjectId = local.Project_id,
        });
        var testDevice = new EquinixMetal.Device("testDevice", new EquinixMetal.DeviceArgs
        {
            Hostname = "test",
            Plan = "m1.xlarge.x86",
            Facilities = 
            {
                "ewr1",
            },
            OperatingSystem = "ubuntu_16_04",
            BillingCycle = "hourly",
            ProjectId = local.Project_id,
        });
        var testDeviceNetworkType = new EquinixMetal.DeviceNetworkType("testDeviceNetworkType", new EquinixMetal.DeviceNetworkTypeArgs
        {
            DeviceId = testDevice.Id,
            Type = "hybrid",
        });
        var testPortVlanAttachment = new EquinixMetal.PortVlanAttachment("testPortVlanAttachment", new EquinixMetal.PortVlanAttachmentArgs
        {
            DeviceId = testDeviceNetworkType.Id,
            PortName = "eth1",
            VlanVnid = testVlan.Vxlan,
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-equinix-metal/sdk/go/equinix-metal"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        testVlan, err := equinix - metal.NewVlan(ctx, "testVlan", &equinix-metal.VlanArgs{
            Description: pulumi.String("VLAN in New Jersey"),
            Facility:    pulumi.String("ewr1"),
            ProjectId:   pulumi.Any(local.Project_id),
        })
        if err != nil {
            return err
        }
        testDevice, err := equinix - metal.NewDevice(ctx, "testDevice", &equinix-metal.DeviceArgs{
            Hostname: pulumi.String("test"),
            Plan:     pulumi.String("m1.xlarge.x86"),
            Facilities: pulumi.StringArray{
                pulumi.String("ewr1"),
            },
            OperatingSystem: pulumi.String("ubuntu_16_04"),
            BillingCycle:    pulumi.String("hourly"),
            ProjectId:       pulumi.Any(local.Project_id),
        })
        if err != nil {
            return err
        }
        testDeviceNetworkType, err := equinix - metal.NewDeviceNetworkType(ctx, "testDeviceNetworkType", &equinix-metal.DeviceNetworkTypeArgs{
            DeviceId: testDevice.ID(),
            Type:     pulumi.String("hybrid"),
        })
        if err != nil {
            return err
        }
        _, err = equinix - metal.NewPortVlanAttachment(ctx, "testPortVlanAttachment", &equinix-metal.PortVlanAttachmentArgs{
            DeviceId: testDeviceNetworkType.ID(),
            PortName: pulumi.String("eth1"),
            VlanVnid: testVlan.Vxlan,
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_equinix_metal as equinix_metal

test_vlan = equinix_metal.Vlan("testVlan",
    description="VLAN in New Jersey",
    facility="ewr1",
    project_id=local["project_id"])
test_device = equinix_metal.Device("testDevice",
    hostname="test",
    plan="m1.xlarge.x86",
    facilities=["ewr1"],
    operating_system="ubuntu_16_04",
    billing_cycle="hourly",
    project_id=local["project_id"])
test_device_network_type = equinix_metal.DeviceNetworkType("testDeviceNetworkType",
    device_id=test_device.id,
    type="hybrid")
test_port_vlan_attachment = equinix_metal.PortVlanAttachment("testPortVlanAttachment",
    device_id=test_device_network_type.id,
    port_name="eth1",
    vlan_vnid=test_vlan.vxlan)
import * as pulumi from "@pulumi/pulumi";
import * as equinix_metal from "@pulumi/equinix-metal";

const testVlan = new equinix_metal.Vlan("testVlan", {
    description: "VLAN in New Jersey",
    facility: "ewr1",
    projectId: local.project_id,
});
const testDevice = new equinix_metal.Device("testDevice", {
    hostname: "test",
    plan: "m1.xlarge.x86",
    facilities: ["ewr1"],
    operatingSystem: "ubuntu_16_04",
    billingCycle: "hourly",
    projectId: local.project_id,
});
const testDeviceNetworkType = new equinix_metal.DeviceNetworkType("testDeviceNetworkType", {
    deviceId: testDevice.id,
    type: "hybrid",
});
const testPortVlanAttachment = new equinix_metal.PortVlanAttachment("testPortVlanAttachment", {
    deviceId: testDeviceNetworkType.id,
    portName: "eth1",
    vlanVnid: testVlan.vxlan,
});

Layer 2 network

using Pulumi;
using EquinixMetal = Pulumi.EquinixMetal;

class MyStack : Stack
{
    public MyStack()
    {
        var testDevice = new EquinixMetal.Device("testDevice", new EquinixMetal.DeviceArgs
        {
            Hostname = "test",
            Plan = "m1.xlarge.x86",
            Facilities = 
            {
                "ewr1",
            },
            OperatingSystem = "ubuntu_16_04",
            BillingCycle = "hourly",
            ProjectId = local.Project_id,
        });
        var testDeviceNetworkType = new EquinixMetal.DeviceNetworkType("testDeviceNetworkType", new EquinixMetal.DeviceNetworkTypeArgs
        {
            DeviceId = testDevice.Id,
            Type = "layer2-individual",
        });
        var test1Vlan = new EquinixMetal.Vlan("test1Vlan", new EquinixMetal.VlanArgs
        {
            Description = "VLAN in New Jersey",
            Facility = "ewr1",
            ProjectId = local.Project_id,
        });
        var test2Vlan = new EquinixMetal.Vlan("test2Vlan", new EquinixMetal.VlanArgs
        {
            Description = "VLAN in New Jersey",
            Facility = "ewr1",
            ProjectId = local.Project_id,
        });
        var test1PortVlanAttachment = new EquinixMetal.PortVlanAttachment("test1PortVlanAttachment", new EquinixMetal.PortVlanAttachmentArgs
        {
            DeviceId = testDeviceNetworkType.Id,
            VlanVnid = test1Vlan.Vxlan,
            PortName = "eth1",
        });
        var test2PortVlanAttachment = new EquinixMetal.PortVlanAttachment("test2PortVlanAttachment", new EquinixMetal.PortVlanAttachmentArgs
        {
            DeviceId = testDeviceNetworkType.Id,
            VlanVnid = test2Vlan.Vxlan,
            PortName = "eth1",
            Native = true,
        }, new CustomResourceOptions
        {
            DependsOn = 
            {
                "metal_port_vlan_attachment.test1",
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-equinix-metal/sdk/go/equinix-metal"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        testDevice, err := equinix - metal.NewDevice(ctx, "testDevice", &equinix-metal.DeviceArgs{
            Hostname: pulumi.String("test"),
            Plan:     pulumi.String("m1.xlarge.x86"),
            Facilities: pulumi.StringArray{
                pulumi.String("ewr1"),
            },
            OperatingSystem: pulumi.String("ubuntu_16_04"),
            BillingCycle:    pulumi.String("hourly"),
            ProjectId:       pulumi.Any(local.Project_id),
        })
        if err != nil {
            return err
        }
        testDeviceNetworkType, err := equinix - metal.NewDeviceNetworkType(ctx, "testDeviceNetworkType", &equinix-metal.DeviceNetworkTypeArgs{
            DeviceId: testDevice.ID(),
            Type:     pulumi.String("layer2-individual"),
        })
        if err != nil {
            return err
        }
        test1Vlan, err := equinix - metal.NewVlan(ctx, "test1Vlan", &equinix-metal.VlanArgs{
            Description: pulumi.String("VLAN in New Jersey"),
            Facility:    pulumi.String("ewr1"),
            ProjectId:   pulumi.Any(local.Project_id),
        })
        if err != nil {
            return err
        }
        test2Vlan, err := equinix - metal.NewVlan(ctx, "test2Vlan", &equinix-metal.VlanArgs{
            Description: pulumi.String("VLAN in New Jersey"),
            Facility:    pulumi.String("ewr1"),
            ProjectId:   pulumi.Any(local.Project_id),
        })
        if err != nil {
            return err
        }
        _, err = equinix - metal.NewPortVlanAttachment(ctx, "test1PortVlanAttachment", &equinix-metal.PortVlanAttachmentArgs{
            DeviceId: testDeviceNetworkType.ID(),
            VlanVnid: test1Vlan.Vxlan,
            PortName: pulumi.String("eth1"),
        })
        if err != nil {
            return err
        }
        _, err = equinix - metal.NewPortVlanAttachment(ctx, "test2PortVlanAttachment", &equinix-metal.PortVlanAttachmentArgs{
            DeviceId: testDeviceNetworkType.ID(),
            VlanVnid: test2Vlan.Vxlan,
            PortName: pulumi.String("eth1"),
            Native:   pulumi.Bool(true),
        }, pulumi.DependsOn([]pulumi.Resource{
            "metal_port_vlan_attachment.test1",
        }))
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_equinix_metal as equinix_metal

test_device = equinix_metal.Device("testDevice",
    hostname="test",
    plan="m1.xlarge.x86",
    facilities=["ewr1"],
    operating_system="ubuntu_16_04",
    billing_cycle="hourly",
    project_id=local["project_id"])
test_device_network_type = equinix_metal.DeviceNetworkType("testDeviceNetworkType",
    device_id=test_device.id,
    type="layer2-individual")
test1_vlan = equinix_metal.Vlan("test1Vlan",
    description="VLAN in New Jersey",
    facility="ewr1",
    project_id=local["project_id"])
test2_vlan = equinix_metal.Vlan("test2Vlan",
    description="VLAN in New Jersey",
    facility="ewr1",
    project_id=local["project_id"])
test1_port_vlan_attachment = equinix_metal.PortVlanAttachment("test1PortVlanAttachment",
    device_id=test_device_network_type.id,
    vlan_vnid=test1_vlan.vxlan,
    port_name="eth1")
test2_port_vlan_attachment = equinix_metal.PortVlanAttachment("test2PortVlanAttachment",
    device_id=test_device_network_type.id,
    vlan_vnid=test2_vlan.vxlan,
    port_name="eth1",
    native=True,
    opts=pulumi.ResourceOptions(depends_on=["metal_port_vlan_attachment.test1"]))
import * as pulumi from "@pulumi/pulumi";
import * as equinix_metal from "@pulumi/equinix-metal";

const testDevice = new equinix_metal.Device("testDevice", {
    hostname: "test",
    plan: "m1.xlarge.x86",
    facilities: ["ewr1"],
    operatingSystem: "ubuntu_16_04",
    billingCycle: "hourly",
    projectId: local.project_id,
});
const testDeviceNetworkType = new equinix_metal.DeviceNetworkType("testDeviceNetworkType", {
    deviceId: testDevice.id,
    type: "layer2-individual",
});
const test1Vlan = new equinix_metal.Vlan("test1Vlan", {
    description: "VLAN in New Jersey",
    facility: "ewr1",
    projectId: local.project_id,
});
const test2Vlan = new equinix_metal.Vlan("test2Vlan", {
    description: "VLAN in New Jersey",
    facility: "ewr1",
    projectId: local.project_id,
});
const test1PortVlanAttachment = new equinix_metal.PortVlanAttachment("test1PortVlanAttachment", {
    deviceId: testDeviceNetworkType.id,
    vlanVnid: test1Vlan.vxlan,
    portName: "eth1",
});
const test2PortVlanAttachment = new equinix_metal.PortVlanAttachment("test2PortVlanAttachment", {
    deviceId: testDeviceNetworkType.id,
    vlanVnid: test2Vlan.vxlan,
    portName: "eth1",
    native: true,
}, {
    dependsOn: ["metal_port_vlan_attachment.test1"],
});

Create a PortVlanAttachment Resource

new PortVlanAttachment(name: string, args: PortVlanAttachmentArgs, opts?: CustomResourceOptions);
def PortVlanAttachment(resource_name: str, opts: Optional[ResourceOptions] = None, device_id: Optional[str] = None, force_bond: Optional[bool] = None, native: Optional[bool] = None, port_name: Optional[str] = None, vlan_vnid: Optional[int] = None)
func NewPortVlanAttachment(ctx *Context, name string, args PortVlanAttachmentArgs, opts ...ResourceOption) (*PortVlanAttachment, error)
public PortVlanAttachment(string name, PortVlanAttachmentArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args PortVlanAttachmentArgs
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 PortVlanAttachmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args PortVlanAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

PortVlanAttachment Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The PortVlanAttachment resource accepts the following input properties:

DeviceId string

ID of device to be assigned to the VLAN

PortName string

Name of network port to be assigned to the VLAN

VlanVnid int

VXLAN Network Identifier, integer

ForceBond bool

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

Native bool

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 metal_port_vlan_attachment, just like in the layer2-individual example above.

DeviceId string

ID of device to be assigned to the VLAN

PortName string

Name of network port to be assigned to the VLAN

VlanVnid int

VXLAN Network Identifier, integer

ForceBond bool

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

Native bool

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 metal_port_vlan_attachment, just like in the layer2-individual example above.

deviceId string

ID of device to be assigned to the VLAN

portName string

Name of network port to be assigned to the VLAN

vlanVnid number

VXLAN Network Identifier, integer

forceBond boolean

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

native boolean

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 metal_port_vlan_attachment, just like in the layer2-individual example above.

device_id str

ID of device to be assigned to the VLAN

port_name str

Name of network port to be assigned to the VLAN

vlan_vnid int

VXLAN Network Identifier, integer

force_bond bool

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

native bool

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 metal_port_vlan_attachment, just like in the layer2-individual example above.

Outputs

All input properties are implicitly available as output properties. Additionally, the PortVlanAttachment resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
PortId string
VlanId string
Id string
The provider-assigned unique ID for this managed resource.
PortId string
VlanId string
id string
The provider-assigned unique ID for this managed resource.
portId string
vlanId string
id str
The provider-assigned unique ID for this managed resource.
port_id str
vlan_id str

Look up an Existing PortVlanAttachment Resource

Get an existing PortVlanAttachment 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?: PortVlanAttachmentState, opts?: CustomResourceOptions): PortVlanAttachment
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, device_id: Optional[str] = None, force_bond: Optional[bool] = None, native: Optional[bool] = None, port_id: Optional[str] = None, port_name: Optional[str] = None, vlan_id: Optional[str] = None, vlan_vnid: Optional[int] = None) -> PortVlanAttachment
func GetPortVlanAttachment(ctx *Context, name string, id IDInput, state *PortVlanAttachmentState, opts ...ResourceOption) (*PortVlanAttachment, error)
public static PortVlanAttachment Get(string name, Input<string> id, PortVlanAttachmentState? 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:

DeviceId string

ID of device to be assigned to the VLAN

ForceBond bool

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

Native bool

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 metal_port_vlan_attachment, just like in the layer2-individual example above.

PortId string
PortName string

Name of network port to be assigned to the VLAN

VlanId string
VlanVnid int

VXLAN Network Identifier, integer

DeviceId string

ID of device to be assigned to the VLAN

ForceBond bool

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

Native bool

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 metal_port_vlan_attachment, just like in the layer2-individual example above.

PortId string
PortName string

Name of network port to be assigned to the VLAN

VlanId string
VlanVnid int

VXLAN Network Identifier, integer

deviceId string

ID of device to be assigned to the VLAN

forceBond boolean

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

native boolean

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 metal_port_vlan_attachment, just like in the layer2-individual example above.

portId string
portName string

Name of network port to be assigned to the VLAN

vlanId string
vlanVnid number

VXLAN Network Identifier, integer

device_id str

ID of device to be assigned to the VLAN

force_bond bool

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

native bool

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 metal_port_vlan_attachment, just like in the layer2-individual example above.

port_id str
port_name str

Name of network port to be assigned to the VLAN

vlan_id str
vlan_vnid int

VXLAN Network Identifier, integer

Package Details

Repository
https://github.com/pulumi/pulumi-equinix-metal
License
Apache-2.0
Notes
This Pulumi package is based on the metal Terraform Provider.