equinix.metal.PortVlanAttachment
Explore with Pulumi AI
Provides a resource to attach device ports to VLANs.
Device and VLAN must be in the same metro.
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
- https://metal.equinix.com/developers/docs/networking/layer2/
- https://metal.equinix.com/developers/docs/networking/layer2-configs/
Attribute Referece
In addition to all arguments above, the following attributes are exported:
id
- UUID of device port used in the assignment.vlan_id
- UUID of VLAN API resource.port_id
- UUID of device port.
Example Usage
using System.Collections.Generic;
using Pulumi;
using Equinix = Pulumi.Equinix;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var deviceId = config.Require("deviceId");
var portName = config.Get("portName") ?? "eth1";
var vxlanId = config.GetNumber("vxlanId") ?? 1004;
var attach = new Equinix.Metal.PortVlanAttachment("attach", new()
{
DeviceId = deviceId,
PortName = portName,
VlanVnid = vxlanId,
});
return new Dictionary<string, object?>
{
["attachId"] = attach.Id,
["portId"] = attach.PortId,
};
});
package main
import (
"github.com/equinix/pulumi-equinix/sdk/go/equinix/metal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
deviceId := cfg.Require("deviceId")
portName := "eth1"
if param := cfg.Get("portName"); param != "" {
portName = param
}
vxlanId := 1004
if param := cfg.GetInt("vxlanId"); param != 0 {
vxlanId = param
}
attach, err := metal.NewPortVlanAttachment(ctx, "attach", &metal.PortVlanAttachmentArgs{
DeviceId: pulumi.String(deviceId),
PortName: pulumi.String(portName),
VlanVnid: pulumi.Int(vxlanId),
})
if err != nil {
return err
}
ctx.Export("attachId", attach.ID())
ctx.Export("portId", attach.PortId)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.equinix.pulumi.metal.PortVlanAttachment;
import com.equinix.pulumi.metal.PortVlanAttachmentArgs;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var deviceId = config.get("deviceId").get();
final var portName = config.get("portName").orElse("eth1");
final var vxlanId = Integer.parseInt(config.get("vxlanId").orElse("1004"));
var attach = new PortVlanAttachment("attach", PortVlanAttachmentArgs.builder()
.deviceId(deviceId)
.portName(portName)
.vlanVnid(vxlanId)
.build());
ctx.export("attachId", attach.id());
ctx.export("portId", attach.portId());
}
}
import pulumi
import pulumi_equinix as equinix
config = pulumi.Config()
device_id = config.require("deviceId")
port_name = config.get("portName")
if port_name is None:
port_name = "eth1"
vxlan_id = config.get_int("vxlanId")
if vxlan_id is None:
vxlan_id = 1004
attach = equinix.metal.PortVlanAttachment("attach",
device_id=device_id,
port_name=port_name,
vlan_vnid=vxlan_id)
pulumi.export("attachId", attach.id)
pulumi.export("portId", attach.port_id)
import * as pulumi from "@pulumi/pulumi";
import * as equinix from "@equinix-labs/pulumi-equinix";
const config = new pulumi.Config();
const deviceId = config.require("deviceId");
const portName = config.get("portName") || "eth1";
const vxlanId = config.getNumber("vxlanId") || 1004;
const attach = new equinix.metal.PortVlanAttachment("attach", {
deviceId: deviceId,
portName: portName,
vlanVnid: vxlanId,
});
export const attachId = attach.id;
export const portId = attach.portId;
config:
deviceId:
type: string
portName:
type: string
default: eth1
vxlanId:
type: integer
default: 1004
resources:
attach:
type: equinix:metal:PortVlanAttachment
properties:
deviceId: ${deviceId}
portName: ${portName}
vlanVnid: ${vxlanId}
outputs:
attachId: ${attach.id}
portId: ${attach.portId}
Create PortVlanAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new PortVlanAttachment(name: string, args: PortVlanAttachmentArgs, opts?: CustomResourceOptions);
@overload
def PortVlanAttachment(resource_name: str,
args: PortVlanAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def PortVlanAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
device_id: Optional[str] = None,
port_name: Optional[str] = None,
vlan_vnid: Optional[int] = None,
force_bond: Optional[bool] = None,
native: Optional[bool] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var portVlanAttachmentResource = new Equinix.Metal.PortVlanAttachment("portVlanAttachmentResource", new()
{
DeviceId = "string",
PortName = "string",
VlanVnid = 0,
ForceBond = false,
Native = false,
});
example, err := metal.NewPortVlanAttachment(ctx, "portVlanAttachmentResource", &metal.PortVlanAttachmentArgs{
DeviceId: pulumi.String("string"),
PortName: pulumi.String("string"),
VlanVnid: pulumi.Int(0),
ForceBond: pulumi.Bool(false),
Native: pulumi.Bool(false),
})
var portVlanAttachmentResource = new PortVlanAttachment("portVlanAttachmentResource", PortVlanAttachmentArgs.builder()
.deviceId("string")
.portName("string")
.vlanVnid(0)
.forceBond(false)
.native_(false)
.build());
port_vlan_attachment_resource = equinix.metal.PortVlanAttachment("portVlanAttachmentResource",
device_id="string",
port_name="string",
vlan_vnid=0,
force_bond=False,
native=False)
const portVlanAttachmentResource = new equinix.metal.PortVlanAttachment("portVlanAttachmentResource", {
deviceId: "string",
portName: "string",
vlanVnid: 0,
forceBond: false,
native: false,
});
type: equinix:metal:PortVlanAttachment
properties:
deviceId: string
forceBond: false
native: false
portName: string
vlanVnid: 0
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:
- Device
Id string - ID of device to be assigned to the VLAN.
- Port
Name string - Name of network port to be assigned to the VLAN.
- Vlan
Vnid int - VXLAN Network Identifier.
- 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 anotherequinix.metal.PortVlanAttachment
, just like in the layer2-individual example above.
- Device
Id string - ID of device to be assigned to the VLAN.
- Port
Name string - Name of network port to be assigned to the VLAN.
- Vlan
Vnid int - VXLAN Network Identifier.
- 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 anotherequinix.metal.PortVlanAttachment
, just like in the layer2-individual example above.
- device
Id String - ID of device to be assigned to the VLAN.
- port
Name String - Name of network port to be assigned to the VLAN.
- vlan
Vnid Integer - VXLAN Network Identifier.
- force
Bond 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 anotherequinix.metal.PortVlanAttachment
, just like in the layer2-individual example above.
- device
Id string - ID of device to be assigned to the VLAN.
- port
Name string - Name of network port to be assigned to the VLAN.
- vlan
Vnid number - VXLAN Network Identifier.
- force
Bond 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 anotherequinix.metal.PortVlanAttachment
, 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.
- 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 anotherequinix.metal.PortVlanAttachment
, just like in the layer2-individual example above.
- device
Id String - ID of device to be assigned to the VLAN.
- port
Name String - Name of network port to be assigned to the VLAN.
- vlan
Vnid Number - VXLAN Network Identifier.
- force
Bond 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 anotherequinix.metal.PortVlanAttachment
, 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:
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.
- Device
Id string - 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 anotherequinix.metal.PortVlanAttachment
, just like in the layer2-individual example above. - Port
Id string - UUID of device port
- Port
Name string - Name of network port to be assigned to the VLAN.
- Vlan
Id string - UUID of VLAN API resource
- Vlan
Vnid int - VXLAN Network Identifier.
- Device
Id string - 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 anotherequinix.metal.PortVlanAttachment
, just like in the layer2-individual example above. - Port
Id string - UUID of device port
- Port
Name string - Name of network port to be assigned to the VLAN.
- Vlan
Id string - UUID of VLAN API resource
- Vlan
Vnid int - VXLAN Network Identifier.
- device
Id String - ID of device to be assigned to the VLAN.
- force
Bond 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 anotherequinix.metal.PortVlanAttachment
, just like in the layer2-individual example above. - port
Id String - UUID of device port
- port
Name String - Name of network port to be assigned to the VLAN.
- vlan
Id String - UUID of VLAN API resource
- vlan
Vnid Integer - VXLAN Network Identifier.
- device
Id string - ID of device to be assigned to the VLAN.
- force
Bond 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 anotherequinix.metal.PortVlanAttachment
, just like in the layer2-individual example above. - port
Id string - UUID of device port
- port
Name string - Name of network port to be assigned to the VLAN.
- vlan
Id string - UUID of VLAN API resource
- vlan
Vnid number - VXLAN Network Identifier.
- 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 anotherequinix.metal.PortVlanAttachment
, 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.
- device
Id String - ID of device to be assigned to the VLAN.
- force
Bond 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 anotherequinix.metal.PortVlanAttachment
, just like in the layer2-individual example above. - port
Id String - UUID of device port
- port
Name String - Name of network port to be assigned to the VLAN.
- vlan
Id String - UUID of VLAN API resource
- vlan
Vnid Number - VXLAN Network Identifier.
Package Details
- Repository
- equinix equinix/pulumi-equinix
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
equinix
Terraform Provider.