packet.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 Packet, refer to
- https://www.packet.com/resources/guides/layer-2-configurations/
- https://www.packet.com/developers/docs/network/advanced/layer-2/
Attribute Referece
id
- UUID of device port used in the assignmentvlan_id
- UUID of VLAN API resourceport_id
- UUID of device port
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,
});
var testDeviceNetworkType = new Packet.DeviceNetworkType("testDeviceNetworkType", new Packet.DeviceNetworkTypeArgs
{
DeviceId = testDevice.Id,
Type = "hybrid",
});
var testPortVlanAttachment = new Packet.PortVlanAttachment("testPortVlanAttachment", new Packet.PortVlanAttachmentArgs
{
DeviceId = testDeviceNetworkType.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,
});
var testIndex_deviceNetworkTypeDeviceNetworkType = new Packet.DeviceNetworkType("testIndex/deviceNetworkTypeDeviceNetworkType", new Packet.DeviceNetworkTypeArgs
{
DeviceId = testDevice.Id,
Type = "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 = testDeviceNetworkType.Id,
VlanVnid = test1Vlan.Vxlan,
PortName = "eth1",
});
var test2PortVlanAttachment = new Packet.PortVlanAttachment("test2PortVlanAttachment", new Packet.PortVlanAttachmentArgs
{
DeviceId = testDeviceNetworkType.Id,
VlanVnid = test2Vlan.Vxlan,
PortName = "eth1",
Native = true,
}, new CustomResourceOptions
{
DependsOn =
{
"packet_port_vlan_attachment.test1",
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-packet/sdk/v3/go/packet"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
testVlan, err := packet.NewVlan(ctx, "testVlan", &packet.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 := packet.NewDevice(ctx, "testDevice", &packet.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 := packet.NewDeviceNetworkType(ctx, "testDeviceNetworkType", &packet.DeviceNetworkTypeArgs{
DeviceId: testDevice.ID(),
Type: pulumi.String("hybrid"),
})
if err != nil {
return err
}
_, err = packet.NewPortVlanAttachment(ctx, "testPortVlanAttachment", &packet.PortVlanAttachmentArgs{
DeviceId: testDeviceNetworkType.ID(),
PortName: pulumi.String("eth1"),
VlanVnid: testVlan.Vxlan,
})
if err != nil {
return err
}
_, err = packet.NewDevice(ctx, "testIndex_deviceDevice", &packet.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
}
_, err = packet.NewDeviceNetworkType(ctx, "testIndex_deviceNetworkTypeDeviceNetworkType", &packet.DeviceNetworkTypeArgs{
DeviceId: testDevice.ID(),
Type: pulumi.String("layer2-individual"),
})
if err != nil {
return err
}
test1Vlan, err := packet.NewVlan(ctx, "test1Vlan", &packet.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 := packet.NewVlan(ctx, "test2Vlan", &packet.VlanArgs{
Description: pulumi.String("VLAN in New Jersey"),
Facility: pulumi.String("ewr1"),
ProjectId: pulumi.Any(local.Project_id),
})
if err != nil {
return err
}
_, err = packet.NewPortVlanAttachment(ctx, "test1PortVlanAttachment", &packet.PortVlanAttachmentArgs{
DeviceId: testDeviceNetworkType.ID(),
VlanVnid: test1Vlan.Vxlan,
PortName: pulumi.String("eth1"),
})
if err != nil {
return err
}
_, err = packet.NewPortVlanAttachment(ctx, "test2PortVlanAttachment", &packet.PortVlanAttachmentArgs{
DeviceId: testDeviceNetworkType.ID(),
VlanVnid: test2Vlan.Vxlan,
PortName: pulumi.String("eth1"),
Native: pulumi.Bool(true),
}, pulumi.DependsOn([]pulumi.Resource{
"packet_port_vlan_attachment.test1",
}))
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_packet as packet
# Hybrid network type
test_vlan = packet.Vlan("testVlan",
description="VLAN in New Jersey",
facility="ewr1",
project_id=local["project_id"])
test_device = packet.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 = packet.DeviceNetworkType("testDeviceNetworkType",
device_id=test_device.id,
type="hybrid")
test_port_vlan_attachment = packet.PortVlanAttachment("testPortVlanAttachment",
device_id=test_device_network_type.id,
port_name="eth1",
vlan_vnid=test_vlan.vxlan)
# Layer 2 network
test_index_device_device = packet.Device("testIndex/deviceDevice",
hostname="test",
plan="m1.xlarge.x86",
facilities=["ewr1"],
operating_system="ubuntu_16_04",
billing_cycle="hourly",
project_id=local["project_id"])
test_index_device_network_type_device_network_type = packet.DeviceNetworkType("testIndex/deviceNetworkTypeDeviceNetworkType",
device_id=test_device.id,
type="layer2-individual")
test1_vlan = packet.Vlan("test1Vlan",
description="VLAN in New Jersey",
facility="ewr1",
project_id=local["project_id"])
test2_vlan = packet.Vlan("test2Vlan",
description="VLAN in New Jersey",
facility="ewr1",
project_id=local["project_id"])
test1_port_vlan_attachment = packet.PortVlanAttachment("test1PortVlanAttachment",
device_id=test_device_network_type.id,
vlan_vnid=test1_vlan.vxlan,
port_name="eth1")
test2_port_vlan_attachment = packet.PortVlanAttachment("test2PortVlanAttachment",
device_id=test_device_network_type.id,
vlan_vnid=test2_vlan.vxlan,
port_name="eth1",
native=True,
opts=ResourceOptions(depends_on=["packet_port_vlan_attachment.test1"]))
import * as pulumi from "@pulumi/pulumi";
import * as packet from "@pulumi/packet";
// Hybrid network type
const testVlan = new packet.Vlan("testVlan", {
description: "VLAN in New Jersey",
facility: "ewr1",
projectId: local.project_id,
});
const testDevice = new packet.Device("testDevice", {
hostname: "test",
plan: "m1.xlarge.x86",
facilities: ["ewr1"],
operatingSystem: "ubuntu_16_04",
billingCycle: "hourly",
projectId: local.project_id,
});
const testDeviceNetworkType = new packet.DeviceNetworkType("testDeviceNetworkType", {
deviceId: testDevice.id,
type: "hybrid",
});
const testPortVlanAttachment = new packet.PortVlanAttachment("testPortVlanAttachment", {
deviceId: testDeviceNetworkType.id,
portName: "eth1",
vlanVnid: testVlan.vxlan,
});
// Layer 2 network
const testIndex_deviceDevice = new packet.Device("testIndex/deviceDevice", {
hostname: "test",
plan: "m1.xlarge.x86",
facilities: ["ewr1"],
operatingSystem: "ubuntu_16_04",
billingCycle: "hourly",
projectId: local.project_id,
});
const testIndex_deviceNetworkTypeDeviceNetworkType = new packet.DeviceNetworkType("testIndex/deviceNetworkTypeDeviceNetworkType", {
deviceId: testDevice.id,
type: "layer2-individual",
});
const test1Vlan = new packet.Vlan("test1Vlan", {
description: "VLAN in New Jersey",
facility: "ewr1",
projectId: local.project_id,
});
const test2Vlan = new packet.Vlan("test2Vlan", {
description: "VLAN in New Jersey",
facility: "ewr1",
projectId: local.project_id,
});
const test1PortVlanAttachment = new packet.PortVlanAttachment("test1PortVlanAttachment", {
deviceId: testDeviceNetworkType.id,
vlanVnid: test1Vlan.vxlan,
portName: "eth1",
});
const test2PortVlanAttachment = new packet.PortVlanAttachment("test2PortVlanAttachment", {
deviceId: testDeviceNetworkType.id,
vlanVnid: test2Vlan.vxlan,
portName: "eth1",
native: true,
}, {
dependsOn: ["packet_port_vlan_attachment.test1"],
});
Coming soon!
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: packet: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 Packet.PortVlanAttachment("portVlanAttachmentResource", new()
{
DeviceId = "string",
PortName = "string",
VlanVnid = 0,
ForceBond = false,
Native = false,
});
example, err := packet.NewPortVlanAttachment(ctx, "portVlanAttachmentResource", &packet.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 = packet.PortVlanAttachment("portVlanAttachmentResource",
device_id="string",
port_name="string",
vlan_vnid=0,
force_bond=False,
native=False)
const portVlanAttachmentResource = new packet.PortVlanAttachment("portVlanAttachmentResource", {
deviceId: "string",
portName: "string",
vlanVnid: 0,
forceBond: false,
native: false,
});
type: packet: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, 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 packet_port_vlan_attachment, 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, 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 packet_port_vlan_attachment, 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, integer
- 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 another packet_port_vlan_attachment, 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, integer
- 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 another packet_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 packet_port_vlan_attachment, 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, integer
- 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 another packet_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:
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 another packet_port_vlan_attachment, just like in the layer2-individual example above. - Port
Id string - Port
Name string - Name of network port to be assigned to the VLAN
- Vlan
Id string - Vlan
Vnid int - VXLAN Network Identifier, integer
- 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 another packet_port_vlan_attachment, just like in the layer2-individual example above. - Port
Id string - Port
Name string - Name of network port to be assigned to the VLAN
- Vlan
Id string - Vlan
Vnid int - VXLAN Network Identifier, integer
- 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 another packet_port_vlan_attachment, just like in the layer2-individual example above. - port
Id String - port
Name String - Name of network port to be assigned to the VLAN
- vlan
Id String - vlan
Vnid Integer - VXLAN Network Identifier, integer
- 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 another packet_port_vlan_attachment, just like in the layer2-individual example above. - port
Id string - port
Name string - Name of network port to be assigned to the VLAN
- vlan
Id string - vlan
Vnid 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 packet_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
- 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 another packet_port_vlan_attachment, just like in the layer2-individual example above. - port
Id String - port
Name String - Name of network port to be assigned to the VLAN
- vlan
Id String - vlan
Vnid Number - VXLAN Network Identifier, integer
Package Details
- Repository
- Packet pulumi/pulumi-packet
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
packet
Terraform Provider.