equinix-metal logo
Equinix Metal v3.2.1, Dec 30 21

equinix-metal.PortVlanAttachment

Explore with Pulumi AI

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

Attribute Referece

  • id - UUID of device port used in the assignment
  • vlan_id - UUID of VLAN API resource
  • port_id - UUID of device port

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 = "ny5",
            ProjectId = local.Project_id,
        });
        var testDevice = new EquinixMetal.Device("testDevice", new EquinixMetal.DeviceArgs
        {
            Hostname = "test",
            Plan = "c3.small.x86",
            Facilities = 
            {
                "ny5",
            },
            OperatingSystem = "ubuntu_20_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/v3/go/equinix-metal"
	"github.com/pulumi/pulumi/sdk/v3/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("ny5"),
			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("c3.small.x86"),
			Facilities: pulumi.StringArray{
				pulumi.String("ny5"),
			},
			OperatingSystem: pulumi.String("ubuntu_20_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
	})
}

Coming soon!

import pulumi
import pulumi_equinix_metal as equinix_metal

test_vlan = equinix_metal.Vlan("testVlan",
    description="VLAN in New Jersey",
    facility="ny5",
    project_id=local["project_id"])
test_device = equinix_metal.Device("testDevice",
    hostname="test",
    plan="c3.small.x86",
    facilities=["ny5"],
    operating_system="ubuntu_20_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: "ny5",
    projectId: local.project_id,
});
const testDevice = new equinix_metal.Device("testDevice", {
    hostname: "test",
    plan: "c3.small.x86",
    facilities: ["ny5"],
    operatingSystem: "ubuntu_20_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,
});

Coming soon!

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 = "c3.small.x86",
            Facilities = 
            {
                "ny5",
            },
            OperatingSystem = "ubuntu_20_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 = "ny5",
            ProjectId = local.Project_id,
        });
        var test2Vlan = new EquinixMetal.Vlan("test2Vlan", new EquinixMetal.VlanArgs
        {
            Description = "VLAN in New Jersey",
            Facility = "ny5",
            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/v3/go/equinix-metal"
	"github.com/pulumi/pulumi/sdk/v3/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("c3.small.x86"),
			Facilities: pulumi.StringArray{
				pulumi.String("ny5"),
			},
			OperatingSystem: pulumi.String("ubuntu_20_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("ny5"),
			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("ny5"),
			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{
			pulumi.Resource("metal_port_vlan_attachment.test1"),
		}))
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_equinix_metal as equinix_metal

test_device = equinix_metal.Device("testDevice",
    hostname="test",
    plan="c3.small.x86",
    facilities=["ny5"],
    operating_system="ubuntu_20_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="ny5",
    project_id=local["project_id"])
test2_vlan = equinix_metal.Vlan("test2Vlan",
    description="VLAN in New Jersey",
    facility="ny5",
    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: "c3.small.x86",
    facilities: ["ny5"],
    operatingSystem: "ubuntu_20_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: "ny5",
    projectId: local.project_id,
});
const test2Vlan = new equinix_metal.Vlan("test2Vlan", {
    description: "VLAN in New Jersey",
    facility: "ny5",
    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"],
});

Coming soon!

Create PortVlanAttachment Resource

new PortVlanAttachment(name: string, args: PortVlanAttachmentArgs, opts?: CustomResourceOptions);
@overload
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)
@overload
def PortVlanAttachment(resource_name: str,
                       args: PortVlanAttachmentArgs,
                       opts: Optional[ResourceOptions] = None)
func NewPortVlanAttachment(ctx *Context, name string, args PortVlanAttachmentArgs, opts ...ResourceOption) (*PortVlanAttachment, error)
public PortVlanAttachment(string name, PortVlanAttachmentArgs args, CustomResourceOptions? opts = null)
public PortVlanAttachment(String name, PortVlanAttachmentArgs args)
public PortVlanAttachment(String name, PortVlanAttachmentArgs args, CustomResourceOptions options)
type: equinix-metal:PortVlanAttachment
properties: # The arguments to resource properties.
options: # 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.
resource_name str
The unique name of the resource.
args PortVlanAttachmentArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control 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.
name String
The unique name of the resource.
args PortVlanAttachmentArgs
The arguments to resource properties.
options 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 Architecture and Concepts 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 Integer

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.

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.

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.

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

UUID of device port

VlanId string

UUID of VLAN API resource

Id string

The provider-assigned unique ID for this managed resource.

PortId string

UUID of device port

VlanId string

UUID of VLAN API resource

id String

The provider-assigned unique ID for this managed resource.

portId String

UUID of device port

vlanId String

UUID of VLAN API resource

id string

The provider-assigned unique ID for this managed resource.

portId string

UUID of device port

vlanId string

UUID of VLAN API resource

id str

The provider-assigned unique ID for this managed resource.

port_id str

UUID of device port

vlan_id str

UUID of VLAN API resource

id String

The provider-assigned unique ID for this managed resource.

portId String

UUID of device port

vlanId String

UUID of VLAN API resource

Look up 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)
public static PortVlanAttachment get(String name, Output<String> id, PortVlanAttachmentState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
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.
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

UUID of device port

PortName string

Name of network port to be assigned to the VLAN

VlanId string

UUID of VLAN API resource

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

UUID of device port

PortName string

Name of network port to be assigned to the VLAN

VlanId string

UUID of VLAN API resource

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

UUID of device port

portName String

Name of network port to be assigned to the VLAN

vlanId String

UUID of VLAN API resource

vlanVnid Integer

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

UUID of device port

portName string

Name of network port to be assigned to the VLAN

vlanId string

UUID of VLAN API resource

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

UUID of device port

port_name str

Name of network port to be assigned to the VLAN

vlan_id str

UUID of VLAN API resource

vlan_vnid 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

UUID of device port

portName String

Name of network port to be assigned to the VLAN

vlanId String

UUID of VLAN API resource

vlanVnid Number

VXLAN Network Identifier, integer

Package Details

Repository
Equinix Metal pulumi/pulumi-equinix-metal
License
Apache-2.0
Notes

This Pulumi package is based on the metal Terraform Provider.