published on Friday, Sep 4, 2026 by e-breuninger
published on Friday, Sep 4, 2026 by e-breuninger
From the official documentation:
A VLAN represents an isolated layer two domain, identified by a name and a numeric ID (1-4094) as defined in IEEE 802.1Q. VLANs are arranged into VLAN groups to define scope and to enforce uniqueness.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";
const example1 = new netbox.Vlan("example1", {
name: "VLAN 1",
vid: 1777,
tags: [],
});
// Assume netbox_tenant, netbox_site, and netbox_tag resources exist
const example2 = new netbox.Vlan("example2", {
name: "VLAN 2",
vid: 1778,
status: "reserved",
description: "Reserved example VLAN",
tenantId: exNetboxTenant.id,
siteId: exNetboxSite.id,
groupId: ex.id,
tags: [exNetboxTag.name],
});
import pulumi
import pulumi_netbox as netbox
example1 = netbox.Vlan("example1",
name="VLAN 1",
vid=1777,
tags=[])
# Assume netbox_tenant, netbox_site, and netbox_tag resources exist
example2 = netbox.Vlan("example2",
name="VLAN 2",
vid=1778,
status="reserved",
description="Reserved example VLAN",
tenant_id=ex_netbox_tenant["id"],
site_id=ex_netbox_site["id"],
group_id=ex["id"],
tags=[ex_netbox_tag["name"]])
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v5/netbox"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := netbox.NewVlan(ctx, "example1", &netbox.VlanArgs{
Name: pulumi.String("VLAN 1"),
Vid: pulumi.Float64(1777),
Tags: pulumi.StringArray{},
})
if err != nil {
return err
}
// Assume netbox_tenant, netbox_site, and netbox_tag resources exist
_, err = netbox.NewVlan(ctx, "example2", &netbox.VlanArgs{
Name: pulumi.String("VLAN 2"),
Vid: pulumi.Float64(1778),
Status: pulumi.String("reserved"),
Description: pulumi.String("Reserved example VLAN"),
TenantId: pulumi.Any(exNetboxTenant.Id),
SiteId: pulumi.Any(exNetboxSite.Id),
GroupId: pulumi.Any(ex.Id),
Tags: pulumi.StringArray{
exNetboxTag.Name,
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Netbox = Pulumi.Netbox;
return await Deployment.RunAsync(() =>
{
var example1 = new Netbox.Vlan("example1", new()
{
Name = "VLAN 1",
Vid = 1777,
Tags = new[] {},
});
// Assume netbox_tenant, netbox_site, and netbox_tag resources exist
var example2 = new Netbox.Vlan("example2", new()
{
Name = "VLAN 2",
Vid = 1778,
Status = "reserved",
Description = "Reserved example VLAN",
TenantId = exNetboxTenant.Id,
SiteId = exNetboxSite.Id,
GroupId = ex.Id,
Tags = new[]
{
exNetboxTag.Name,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.Vlan;
import com.pulumi.netbox.VlanArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example1 = new Vlan("example1", VlanArgs.builder()
.name("VLAN 1")
.vid(1777.0)
.tags()
.build());
// Assume netbox_tenant, netbox_site, and netbox_tag resources exist
var example2 = new Vlan("example2", VlanArgs.builder()
.name("VLAN 2")
.vid(1778.0)
.status("reserved")
.description("Reserved example VLAN")
.tenantId(exNetboxTenant.id())
.siteId(exNetboxSite.id())
.groupId(ex.id())
.tags(exNetboxTag.name())
.build());
}
}
resources:
example1:
type: netbox:Vlan
properties:
name: VLAN 1
vid: 1777
tags: []
# Assume netbox_tenant, netbox_site, and netbox_tag resources exist
example2:
type: netbox:Vlan
properties:
name: VLAN 2
vid: 1778
status: reserved
description: Reserved example VLAN
tenantId: ${exNetboxTenant.id}
siteId: ${exNetboxSite.id}
groupId: ${ex.id}
tags:
- ${exNetboxTag.name}
Example coming soon!
Create Vlan Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Vlan(name: string, args: VlanArgs, opts?: CustomResourceOptions);@overload
def Vlan(resource_name: str,
args: VlanArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Vlan(resource_name: str,
opts: Optional[ResourceOptions] = None,
vid: Optional[float] = None,
custom_fields: Optional[Mapping[str, str]] = None,
description: Optional[str] = None,
group_id: Optional[float] = None,
name: Optional[str] = None,
role_id: Optional[float] = None,
site_id: Optional[float] = None,
status: Optional[str] = None,
tags: Optional[Sequence[str]] = None,
tenant_id: Optional[float] = None,
vlan_id: Optional[str] = None)func NewVlan(ctx *Context, name string, args VlanArgs, opts ...ResourceOption) (*Vlan, error)public Vlan(string name, VlanArgs args, CustomResourceOptions? opts = null)type: netbox:Vlan
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "netbox_vlan" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args VlanArgs
- 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 VlanArgs
- 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 VlanArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VlanArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args VlanArgs
- 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 vlanResource = new Netbox.Vlan("vlanResource", new()
{
Vid = 0.0,
CustomFields =
{
{ "string", "string" },
},
Description = "string",
GroupId = 0.0,
Name = "string",
RoleId = 0.0,
SiteId = 0.0,
Status = "string",
Tags = new[]
{
"string",
},
TenantId = 0.0,
VlanId = "string",
});
example, err := netbox.NewVlan(ctx, "vlanResource", &netbox.VlanArgs{
Vid: pulumi.Float64(0),
CustomFields: pulumi.StringMap{
"string": pulumi.String("string"),
},
Description: pulumi.String("string"),
GroupId: pulumi.Float64(0),
Name: pulumi.String("string"),
RoleId: pulumi.Float64(0),
SiteId: pulumi.Float64(0),
Status: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
TenantId: pulumi.Float64(0),
VlanId: pulumi.String("string"),
})
resource "netbox_vlan" "vlanResource" {
lifecycle {
create_before_destroy = true
}
vid = 0
custom_fields = {
"string" = "string"
}
description = "string"
group_id = 0
name = "string"
role_id = 0
site_id = 0
status = "string"
tags = ["string"]
tenant_id = 0
vlan_id = "string"
}
var vlanResource = new Vlan("vlanResource", VlanArgs.builder()
.vid(0.0)
.customFields(Map.of("string", "string"))
.description("string")
.groupId(0.0)
.name("string")
.roleId(0.0)
.siteId(0.0)
.status("string")
.tags("string")
.tenantId(0.0)
.vlanId("string")
.build());
vlan_resource = netbox.Vlan("vlanResource",
vid=float(0),
custom_fields={
"string": "string",
},
description="string",
group_id=float(0),
name="string",
role_id=float(0),
site_id=float(0),
status="string",
tags=["string"],
tenant_id=float(0),
vlan_id="string")
const vlanResource = new netbox.Vlan("vlanResource", {
vid: 0,
customFields: {
string: "string",
},
description: "string",
groupId: 0,
name: "string",
roleId: 0,
siteId: 0,
status: "string",
tags: ["string"],
tenantId: 0,
vlanId: "string",
});
type: netbox:Vlan
properties:
customFields:
string: string
description: string
groupId: 0
name: string
roleId: 0
siteId: 0
status: string
tags:
- string
tenantId: 0
vid: 0
vlanId: string
Vlan Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Vlan resource accepts the following input properties:
- Vid double
- Custom
Fields Dictionary<string, string> - Description string
- Defaults to
"". - Group
Id double - Name string
- Role
Id double - Site
Id double - Status string
- Valid values are
active,reservedanddeprecated. Defaults toactive. - List<string>
- Tenant
Id double - Vlan
Id string - The ID of this resource.
- Vid float64
- Custom
Fields map[string]string - Description string
- Defaults to
"". - Group
Id float64 - Name string
- Role
Id float64 - Site
Id float64 - Status string
- Valid values are
active,reservedanddeprecated. Defaults toactive. - []string
- Tenant
Id float64 - Vlan
Id string - The ID of this resource.
- vid number
- custom_
fields map(string) - description string
- Defaults to
"". - group_
id number - name string
- role_
id number - site_
id number - status string
- Valid values are
active,reservedanddeprecated. Defaults toactive. - list(string)
- tenant_
id number - vlan_
id string - The ID of this resource.
- vid Double
- custom
Fields Map<String,String> - description String
- Defaults to
"". - group
Id Double - name String
- role
Id Double - site
Id Double - status String
- Valid values are
active,reservedanddeprecated. Defaults toactive. - List<String>
- tenant
Id Double - vlan
Id String - The ID of this resource.
- vid number
- custom
Fields {[key: string]: string} - description string
- Defaults to
"". - group
Id number - name string
- role
Id number - site
Id number - status string
- Valid values are
active,reservedanddeprecated. Defaults toactive. - string[]
- tenant
Id number - vlan
Id string - The ID of this resource.
- vid float
- custom_
fields Mapping[str, str] - description str
- Defaults to
"". - group_
id float - name str
- role_
id float - site_
id float - status str
- Valid values are
active,reservedanddeprecated. Defaults toactive. - Sequence[str]
- tenant_
id float - vlan_
id str - The ID of this resource.
- vid Number
- custom
Fields Map<String> - description String
- Defaults to
"". - group
Id Number - name String
- role
Id Number - site
Id Number - status String
- Valid values are
active,reservedanddeprecated. Defaults toactive. - List<String>
- tenant
Id Number - vlan
Id String - The ID of this resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the Vlan resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- List<string>
- Id string
- The provider-assigned unique ID for this managed resource.
- []string
- id string
- The provider-assigned unique ID for this managed resource.
- list(string)
- id String
- The provider-assigned unique ID for this managed resource.
- List<String>
- id string
- The provider-assigned unique ID for this managed resource.
- string[]
- id str
- The provider-assigned unique ID for this managed resource.
- Sequence[str]
- id String
- The provider-assigned unique ID for this managed resource.
- List<String>
Look up Existing Vlan Resource
Get an existing Vlan 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?: VlanState, opts?: CustomResourceOptions): Vlan@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
custom_fields: Optional[Mapping[str, str]] = None,
description: Optional[str] = None,
group_id: Optional[float] = None,
name: Optional[str] = None,
role_id: Optional[float] = None,
site_id: Optional[float] = None,
status: Optional[str] = None,
tags: Optional[Sequence[str]] = None,
tags_alls: Optional[Sequence[str]] = None,
tenant_id: Optional[float] = None,
vid: Optional[float] = None,
vlan_id: Optional[str] = None) -> Vlanfunc GetVlan(ctx *Context, name string, id IDInput, state *VlanState, opts ...ResourceOption) (*Vlan, error)public static Vlan Get(string name, Input<string> id, VlanState? state, CustomResourceOptions? opts = null)public static Vlan get(String name, Output<String> id, VlanState state, CustomResourceOptions options)resources: _: type: netbox:Vlan get: id: ${id}import {
to = netbox_vlan.example
id = "${id}"
}
- 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.
- Custom
Fields Dictionary<string, string> - Description string
- Defaults to
"". - Group
Id double - Name string
- Role
Id double - Site
Id double - Status string
- Valid values are
active,reservedanddeprecated. Defaults toactive. - List<string>
- List<string>
- Tenant
Id double - Vid double
- Vlan
Id string - The ID of this resource.
- Custom
Fields map[string]string - Description string
- Defaults to
"". - Group
Id float64 - Name string
- Role
Id float64 - Site
Id float64 - Status string
- Valid values are
active,reservedanddeprecated. Defaults toactive. - []string
- []string
- Tenant
Id float64 - Vid float64
- Vlan
Id string - The ID of this resource.
- custom_
fields map(string) - description string
- Defaults to
"". - group_
id number - name string
- role_
id number - site_
id number - status string
- Valid values are
active,reservedanddeprecated. Defaults toactive. - list(string)
- list(string)
- tenant_
id number - vid number
- vlan_
id string - The ID of this resource.
- custom
Fields Map<String,String> - description String
- Defaults to
"". - group
Id Double - name String
- role
Id Double - site
Id Double - status String
- Valid values are
active,reservedanddeprecated. Defaults toactive. - List<String>
- List<String>
- tenant
Id Double - vid Double
- vlan
Id String - The ID of this resource.
- custom
Fields {[key: string]: string} - description string
- Defaults to
"". - group
Id number - name string
- role
Id number - site
Id number - status string
- Valid values are
active,reservedanddeprecated. Defaults toactive. - string[]
- string[]
- tenant
Id number - vid number
- vlan
Id string - The ID of this resource.
- custom_
fields Mapping[str, str] - description str
- Defaults to
"". - group_
id float - name str
- role_
id float - site_
id float - status str
- Valid values are
active,reservedanddeprecated. Defaults toactive. - Sequence[str]
- Sequence[str]
- tenant_
id float - vid float
- vlan_
id str - The ID of this resource.
- custom
Fields Map<String> - description String
- Defaults to
"". - group
Id Number - name String
- role
Id Number - site
Id Number - status String
- Valid values are
active,reservedanddeprecated. Defaults toactive. - List<String>
- List<String>
- tenant
Id Number - vid Number
- vlan
Id String - The ID of this resource.
Package Details
- Repository
- netbox e-breuninger/terraform-provider-netbox
- License
- Notes
- This Pulumi package is based on the
netboxTerraform Provider.
published on Friday, Sep 4, 2026 by e-breuninger