1. Packages
  2. Netbox Provider
  3. API Docs
  4. Vlan
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

netbox.Vlan

Explore with Pulumi AI

netbox logo
netbox 3.10.0 published on Monday, Apr 14, 2025 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", {
        vid: 1777,
        tags: [],
    });
    // Assume netbox_tenant, netbox_site, and netbox_tag resources exist
    const example2 = new netbox.Vlan("example2", {
        vid: 1778,
        status: "reserved",
        description: "Reserved example VLAN",
        tenantId: netbox_tenant.ex.id,
        siteId: netbox_site.ex.id,
        groupId: netbox_vlan_group.ex.id,
        tags: [netbox_tag.ex.name],
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    example1 = netbox.Vlan("example1",
        vid=1777,
        tags=[])
    # Assume netbox_tenant, netbox_site, and netbox_tag resources exist
    example2 = netbox.Vlan("example2",
        vid=1778,
        status="reserved",
        description="Reserved example VLAN",
        tenant_id=netbox_tenant["ex"]["id"],
        site_id=netbox_site["ex"]["id"],
        group_id=netbox_vlan_group["ex"]["id"],
        tags=[netbox_tag["ex"]["name"]])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v3/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{
    			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{
    			Vid:         pulumi.Float64(1778),
    			Status:      pulumi.String("reserved"),
    			Description: pulumi.String("Reserved example VLAN"),
    			TenantId:    pulumi.Any(netbox_tenant.Ex.Id),
    			SiteId:      pulumi.Any(netbox_site.Ex.Id),
    			GroupId:     pulumi.Any(netbox_vlan_group.Ex.Id),
    			Tags: pulumi.StringArray{
    				netbox_tag.Ex.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()
        {
            Vid = 1777,
            Tags = new[] {},
        });
    
        // Assume netbox_tenant, netbox_site, and netbox_tag resources exist
        var example2 = new Netbox.Vlan("example2", new()
        {
            Vid = 1778,
            Status = "reserved",
            Description = "Reserved example VLAN",
            TenantId = netbox_tenant.Ex.Id,
            SiteId = netbox_site.Ex.Id,
            GroupId = netbox_vlan_group.Ex.Id,
            Tags = new[]
            {
                netbox_tag.Ex.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()
                .vid(1777)
                .tags()
                .build());
    
            // Assume netbox_tenant, netbox_site, and netbox_tag resources exist
            var example2 = new Vlan("example2", VlanArgs.builder()
                .vid(1778)
                .status("reserved")
                .description("Reserved example VLAN")
                .tenantId(netbox_tenant.ex().id())
                .siteId(netbox_site.ex().id())
                .groupId(netbox_vlan_group.ex().id())
                .tags(netbox_tag.ex().name())
                .build());
    
        }
    }
    
    resources:
      example1:
        type: netbox:Vlan
        properties:
          vid: 1777
          tags: []
      # Assume netbox_tenant, netbox_site, and netbox_tag resources exist
      example2:
        type: netbox:Vlan
        properties:
          vid: 1778
          status: reserved
          description: Reserved example VLAN
          tenantId: ${netbox_tenant.ex.id}
          siteId: ${netbox_site.ex.id}
          groupId: ${netbox_vlan_group.ex.id}
          tags:
            - ${netbox_tag.ex.name}
    

    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,
             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)
    public Vlan(String name, VlanArgs args)
    public Vlan(String name, VlanArgs args, CustomResourceOptions options)
    
    type: netbox:Vlan
    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 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,
        Description = "string",
        GroupId = 0,
        Name = "string",
        RoleId = 0,
        SiteId = 0,
        Status = "string",
        Tags = new[]
        {
            "string",
        },
        TenantId = 0,
        VlanId = "string",
    });
    
    example, err := netbox.NewVlan(ctx, "vlanResource", &netbox.VlanArgs{
    	Vid:         pulumi.Float64(0),
    	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"),
    })
    
    var vlanResource = new Vlan("vlanResource", VlanArgs.builder()
        .vid(0)
        .description("string")
        .groupId(0)
        .name("string")
        .roleId(0)
        .siteId(0)
        .status("string")
        .tags("string")
        .tenantId(0)
        .vlanId("string")
        .build());
    
    vlan_resource = netbox.Vlan("vlanResource",
        vid=0,
        description="string",
        group_id=0,
        name="string",
        role_id=0,
        site_id=0,
        status="string",
        tags=["string"],
        tenant_id=0,
        vlan_id="string")
    
    const vlanResource = new netbox.Vlan("vlanResource", {
        vid: 0,
        description: "string",
        groupId: 0,
        name: "string",
        roleId: 0,
        siteId: 0,
        status: "string",
        tags: ["string"],
        tenantId: 0,
        vlanId: "string",
    });
    
    type: netbox:Vlan
    properties:
        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
    Description string
    Defaults to "".
    GroupId double
    Name string
    RoleId double
    SiteId double
    Status string
    Valid values are active, reserved and deprecated. Defaults to active.
    Tags List<string>
    TenantId double
    VlanId string
    The ID of this resource.
    Vid float64
    Description string
    Defaults to "".
    GroupId float64
    Name string
    RoleId float64
    SiteId float64
    Status string
    Valid values are active, reserved and deprecated. Defaults to active.
    Tags []string
    TenantId float64
    VlanId string
    The ID of this resource.
    vid Double
    description String
    Defaults to "".
    groupId Double
    name String
    roleId Double
    siteId Double
    status String
    Valid values are active, reserved and deprecated. Defaults to active.
    tags List<String>
    tenantId Double
    vlanId String
    The ID of this resource.
    vid number
    description string
    Defaults to "".
    groupId number
    name string
    roleId number
    siteId number
    status string
    Valid values are active, reserved and deprecated. Defaults to active.
    tags string[]
    tenantId number
    vlanId string
    The ID of this resource.
    vid float
    description str
    Defaults to "".
    group_id float
    name str
    role_id float
    site_id float
    status str
    Valid values are active, reserved and deprecated. Defaults to active.
    tags Sequence[str]
    tenant_id float
    vlan_id str
    The ID of this resource.
    vid Number
    description String
    Defaults to "".
    groupId Number
    name String
    roleId Number
    siteId Number
    status String
    Valid values are active, reserved and deprecated. Defaults to active.
    tags List<String>
    tenantId Number
    vlanId 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.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    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,
            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,
            vid: Optional[float] = None,
            vlan_id: Optional[str] = None) -> Vlan
    func 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}
    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:
    Description string
    Defaults to "".
    GroupId double
    Name string
    RoleId double
    SiteId double
    Status string
    Valid values are active, reserved and deprecated. Defaults to active.
    Tags List<string>
    TenantId double
    Vid double
    VlanId string
    The ID of this resource.
    Description string
    Defaults to "".
    GroupId float64
    Name string
    RoleId float64
    SiteId float64
    Status string
    Valid values are active, reserved and deprecated. Defaults to active.
    Tags []string
    TenantId float64
    Vid float64
    VlanId string
    The ID of this resource.
    description String
    Defaults to "".
    groupId Double
    name String
    roleId Double
    siteId Double
    status String
    Valid values are active, reserved and deprecated. Defaults to active.
    tags List<String>
    tenantId Double
    vid Double
    vlanId String
    The ID of this resource.
    description string
    Defaults to "".
    groupId number
    name string
    roleId number
    siteId number
    status string
    Valid values are active, reserved and deprecated. Defaults to active.
    tags string[]
    tenantId number
    vid number
    vlanId string
    The ID of this resource.
    description str
    Defaults to "".
    group_id float
    name str
    role_id float
    site_id float
    status str
    Valid values are active, reserved and deprecated. Defaults to active.
    tags Sequence[str]
    tenant_id float
    vid float
    vlan_id str
    The ID of this resource.
    description String
    Defaults to "".
    groupId Number
    name String
    roleId Number
    siteId Number
    status String
    Valid values are active, reserved and deprecated. Defaults to active.
    tags List<String>
    tenantId Number
    vid Number
    vlanId String
    The ID of this resource.

    Package Details

    Repository
    netbox e-breuninger/terraform-provider-netbox
    License
    Notes
    This Pulumi package is based on the netbox Terraform Provider.
    netbox logo
    netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger