1. Packages
  2. Equinix
  3. API Docs
  4. metal
  5. PortVlanAttachment
Equinix v0.11.2 published on Wednesday, Jun 26, 2024 by Equinix

equinix.metal.PortVlanAttachment

Explore with Pulumi AI

equinix logo
Equinix v0.11.2 published on Wednesday, Jun 26, 2024 by Equinix

    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

    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:

    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.
    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 equinix.metal.PortVlanAttachment, 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.
    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 equinix.metal.PortVlanAttachment, 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.
    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 equinix.metal.PortVlanAttachment, 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.
    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 equinix.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 another equinix.metal.PortVlanAttachment, 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.
    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 equinix.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:

    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 equinix.metal.PortVlanAttachment, 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.
    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 equinix.metal.PortVlanAttachment, 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.
    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 equinix.metal.PortVlanAttachment, 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.
    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 equinix.metal.PortVlanAttachment, 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.
    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 equinix.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.
    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 equinix.metal.PortVlanAttachment, 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.

    Package Details

    Repository
    equinix equinix/pulumi-equinix
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the equinix Terraform Provider.
    equinix logo
    Equinix v0.11.2 published on Wednesday, Jun 26, 2024 by Equinix