1. Packages
  2. Linode Provider
  3. API Docs
  4. getVlans
Linode v4.37.0 published on Thursday, Apr 10, 2025 by Pulumi

linode.getVlans

Explore with Pulumi AI

Linode v4.37.0 published on Thursday, Apr 10, 2025 by Pulumi

Beta Notice VLANs are currently available through early access. To use early access resources, the api_version provider argument must be set to v4beta. To learn more, see the early access documentation.

Provides details about Linode VLANs. For more information, see the Linode APIv4 docs.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";

const myInstance = new linode.Instance("my_instance", {
    label: "my_instance",
    image: "linode/ubuntu22.04",
    region: "us-southeast",
    type: "g6-standard-1",
    rootPass: "bogusPassword$",
    interfaces: [{
        purpose: "vlan",
        label: "my-vlan",
    }],
});
const my_vlans = linode.getVlans({
    filters: [{
        name: "label",
        values: ["my-vlan"],
    }],
});
export const vlanLinodes = my_vlans.then(my_vlans => my_vlans.vlans?.[0]?.linodes);
Copy
import pulumi
import pulumi_linode as linode

my_instance = linode.Instance("my_instance",
    label="my_instance",
    image="linode/ubuntu22.04",
    region="us-southeast",
    type="g6-standard-1",
    root_pass="bogusPassword$",
    interfaces=[{
        "purpose": "vlan",
        "label": "my-vlan",
    }])
my_vlans = linode.get_vlans(filters=[{
    "name": "label",
    "values": ["my-vlan"],
}])
pulumi.export("vlanLinodes", my_vlans.vlans[0].linodes)
Copy
package main

import (
	"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := linode.NewInstance(ctx, "my_instance", &linode.InstanceArgs{
			Label:    pulumi.String("my_instance"),
			Image:    pulumi.String("linode/ubuntu22.04"),
			Region:   pulumi.String("us-southeast"),
			Type:     pulumi.String("g6-standard-1"),
			RootPass: pulumi.String("bogusPassword$"),
			Interfaces: linode.InstanceInterfaceArray{
				&linode.InstanceInterfaceArgs{
					Purpose: pulumi.String("vlan"),
					Label:   pulumi.String("my-vlan"),
				},
			},
		})
		if err != nil {
			return err
		}
		my_vlans, err := linode.GetVlans(ctx, &linode.GetVlansArgs{
			Filters: []linode.GetVlansFilter{
				{
					Name: "label",
					Values: []string{
						"my-vlan",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vlanLinodes", my_vlans.Vlans[0].Linodes)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;

return await Deployment.RunAsync(() => 
{
    var myInstance = new Linode.Instance("my_instance", new()
    {
        Label = "my_instance",
        Image = "linode/ubuntu22.04",
        Region = "us-southeast",
        Type = "g6-standard-1",
        RootPass = "bogusPassword$",
        Interfaces = new[]
        {
            new Linode.Inputs.InstanceInterfaceArgs
            {
                Purpose = "vlan",
                Label = "my-vlan",
            },
        },
    });

    var my_vlans = Linode.GetVlans.Invoke(new()
    {
        Filters = new[]
        {
            new Linode.Inputs.GetVlansFilterInputArgs
            {
                Name = "label",
                Values = new[]
                {
                    "my-vlan",
                },
            },
        },
    });

    return new Dictionary<string, object?>
    {
        ["vlanLinodes"] = my_vlans.Apply(my_vlans => my_vlans.Apply(getVlansResult => getVlansResult.Vlans[0]?.Linodes)),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.linode.Instance;
import com.pulumi.linode.InstanceArgs;
import com.pulumi.linode.inputs.InstanceInterfaceArgs;
import com.pulumi.linode.LinodeFunctions;
import com.pulumi.linode.inputs.GetVlansArgs;
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 myInstance = new Instance("myInstance", InstanceArgs.builder()
            .label("my_instance")
            .image("linode/ubuntu22.04")
            .region("us-southeast")
            .type("g6-standard-1")
            .rootPass("bogusPassword$")
            .interfaces(InstanceInterfaceArgs.builder()
                .purpose("vlan")
                .label("my-vlan")
                .build())
            .build());

        final var my-vlans = LinodeFunctions.getVlans(GetVlansArgs.builder()
            .filters(GetVlansFilterArgs.builder()
                .name("label")
                .values("my-vlan")
                .build())
            .build());

        ctx.export("vlanLinodes", my_vlans.vlans()[0].linodes());
    }
}
Copy
resources:
  myInstance:
    type: linode:Instance
    name: my_instance
    properties:
      label: my_instance
      image: linode/ubuntu22.04
      region: us-southeast
      type: g6-standard-1
      rootPass: bogusPassword$
      interfaces:
        - purpose: vlan
          label: my-vlan
variables:
  my-vlans:
    fn::invoke:
      function: linode:getVlans
      arguments:
        filters:
          - name: label
            values:
              - my-vlan
outputs:
  vlanLinodes: ${["my-vlans"].vlans[0].linodes}
Copy

Filterable Fields

  • label

  • region

Using getVlans

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getVlans(args: GetVlansArgs, opts?: InvokeOptions): Promise<GetVlansResult>
function getVlansOutput(args: GetVlansOutputArgs, opts?: InvokeOptions): Output<GetVlansResult>
Copy
def get_vlans(filters: Optional[Sequence[GetVlansFilter]] = None,
              order: Optional[str] = None,
              order_by: Optional[str] = None,
              vlans: Optional[Sequence[GetVlansVlan]] = None,
              opts: Optional[InvokeOptions] = None) -> GetVlansResult
def get_vlans_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetVlansFilterArgs]]]] = None,
              order: Optional[pulumi.Input[str]] = None,
              order_by: Optional[pulumi.Input[str]] = None,
              vlans: Optional[pulumi.Input[Sequence[pulumi.Input[GetVlansVlanArgs]]]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[GetVlansResult]
Copy
func GetVlans(ctx *Context, args *GetVlansArgs, opts ...InvokeOption) (*GetVlansResult, error)
func GetVlansOutput(ctx *Context, args *GetVlansOutputArgs, opts ...InvokeOption) GetVlansResultOutput
Copy

> Note: This function is named GetVlans in the Go SDK.

public static class GetVlans 
{
    public static Task<GetVlansResult> InvokeAsync(GetVlansArgs args, InvokeOptions? opts = null)
    public static Output<GetVlansResult> Invoke(GetVlansInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetVlansResult> getVlans(GetVlansArgs args, InvokeOptions options)
public static Output<GetVlansResult> getVlans(GetVlansArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: linode:index/getVlans:getVlans
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Filters List<GetVlansFilter>
Order string
The order in which results should be returned. (asc, desc; default asc)
OrderBy string
The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
Vlans List<GetVlansVlan>
Filters []GetVlansFilter
Order string
The order in which results should be returned. (asc, desc; default asc)
OrderBy string
The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
Vlans []GetVlansVlan
filters List<GetVlansFilter>
order String
The order in which results should be returned. (asc, desc; default asc)
orderBy String
The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
vlans List<GetVlansVlan>
filters GetVlansFilter[]
order string
The order in which results should be returned. (asc, desc; default asc)
orderBy string
The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
vlans GetVlansVlan[]
filters Sequence[GetVlansFilter]
order str
The order in which results should be returned. (asc, desc; default asc)
order_by str
The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
vlans Sequence[GetVlansVlan]
filters List<Property Map>
order String
The order in which results should be returned. (asc, desc; default asc)
orderBy String
The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
vlans List<Property Map>

getVlans Result

The following output properties are available:

Supporting Types

GetVlansFilter

Name This property is required. string
The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
Values This property is required. List<string>
A list of values for the filter to allow. These values should all be in string form.
MatchBy string
The method to match the field by. (exact, regex, substring; default exact)
Name This property is required. string
The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
Values This property is required. []string
A list of values for the filter to allow. These values should all be in string form.
MatchBy string
The method to match the field by. (exact, regex, substring; default exact)
name This property is required. String
The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
values This property is required. List<String>
A list of values for the filter to allow. These values should all be in string form.
matchBy String
The method to match the field by. (exact, regex, substring; default exact)
name This property is required. string
The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
values This property is required. string[]
A list of values for the filter to allow. These values should all be in string form.
matchBy string
The method to match the field by. (exact, regex, substring; default exact)
name This property is required. str
The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
values This property is required. Sequence[str]
A list of values for the filter to allow. These values should all be in string form.
match_by str
The method to match the field by. (exact, regex, substring; default exact)
name This property is required. String
The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
values This property is required. List<String>
A list of values for the filter to allow. These values should all be in string form.
matchBy String
The method to match the field by. (exact, regex, substring; default exact)

GetVlansVlan

Created This property is required. string
When the VLAN was created.
Label This property is required. string
The unique label of the VLAN.
Linodes This property is required. List<int>
The running Linodes currently attached to the VLAN.
Region This property is required. string
The region the VLAN is located in. See all regions here.
Created This property is required. string
When the VLAN was created.
Label This property is required. string
The unique label of the VLAN.
Linodes This property is required. []int
The running Linodes currently attached to the VLAN.
Region This property is required. string
The region the VLAN is located in. See all regions here.
created This property is required. String
When the VLAN was created.
label This property is required. String
The unique label of the VLAN.
linodes This property is required. List<Integer>
The running Linodes currently attached to the VLAN.
region This property is required. String
The region the VLAN is located in. See all regions here.
created This property is required. string
When the VLAN was created.
label This property is required. string
The unique label of the VLAN.
linodes This property is required. number[]
The running Linodes currently attached to the VLAN.
region This property is required. string
The region the VLAN is located in. See all regions here.
created This property is required. str
When the VLAN was created.
label This property is required. str
The unique label of the VLAN.
linodes This property is required. Sequence[int]
The running Linodes currently attached to the VLAN.
region This property is required. str
The region the VLAN is located in. See all regions here.
created This property is required. String
When the VLAN was created.
label This property is required. String
The unique label of the VLAN.
linodes This property is required. List<Number>
The running Linodes currently attached to the VLAN.
region This property is required. String
The region the VLAN is located in. See all regions here.

Package Details

Repository
Linode pulumi/pulumi-linode
License
Apache-2.0
Notes
This Pulumi package is based on the linode Terraform Provider.
Linode v4.37.0 published on Thursday, Apr 10, 2025 by Pulumi