Class 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 Packet, refer to
- https://www.packet.com/resources/guides/layer-2-configurations/
- https://www.packet.com/developers/docs/network/advanced/layer-2/
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,
NetworkType = "hybrid",
});
var testPortVlanAttachment = new Packet.PortVlanAttachment("testPortVlanAttachment", new Packet.PortVlanAttachmentArgs
{
DeviceId = testDevice.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,
NetworkType = "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 = testDevice.Id,
VlanVnid = test1Vlan.Vxlan,
PortName = "eth1",
});
var test2PortVlanAttachment = new Packet.PortVlanAttachment("test2PortVlanAttachment", new Packet.PortVlanAttachmentArgs
{
DeviceId = testDevice.Id,
VlanVnid = test2Vlan.Vxlan,
PortName = "eth1",
Native = true,
});
}
}
Attribute Referece
id- UUID of device port used in the assignmentvlan_id- UUID of VLAN API resourceport_id- UUID of device port
Inherited Members
Namespace: Pulumi.Packet
Assembly: Pulumi.Packet.dll
Syntax
public class PortVlanAttachment : CustomResource
Constructors
View SourcePortVlanAttachment(String, PortVlanAttachmentArgs, CustomResourceOptions)
Create a PortVlanAttachment resource with the given unique name, arguments, and options.
Declaration
public PortVlanAttachment(string name, PortVlanAttachmentArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| PortVlanAttachmentArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceDeviceId
ID of device to be assigned to the VLAN
Declaration
public Output<string> DeviceId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ForceBond
Add port back to the bond when this resource is removed. Default is false.
Declaration
public Output<bool?> ForceBond { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
Native
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.
Declaration
public Output<bool?> Native { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
PortId
Declaration
public Output<string> PortId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PortName
Name of network port to be assigned to the VLAN
Declaration
public Output<string> PortName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
VlanId
Declaration
public Output<string> VlanId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
VlanVnid
VXLAN Network Identifier, integer
Declaration
public Output<int> VlanVnid { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
Methods
View SourceGet(String, Input<String>, PortVlanAttachmentState, CustomResourceOptions)
Get an existing PortVlanAttachment resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static PortVlanAttachment Get(string name, Input<string> id, PortVlanAttachmentState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| PortVlanAttachmentState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| PortVlanAttachment |