1. Packages
  2. Linode Provider
  3. API Docs
  4. getVpcSubnets
Linode v5.7.0 published on Saturday, Jan 17, 2026 by Pulumi
linode logo
Linode v5.7.0 published on Saturday, Jan 17, 2026 by Pulumi

    Provides information about a list of Linode VPC subnets that match a set of filters. For more information, see the Linode APIv4 docs.

    Example Usage

    The following example shows how one might use this data source to list VPC subnets.

    import * as pulumi from "@pulumi/pulumi";
    import * as linode from "@pulumi/linode";
    
    const filtered_subnets = linode.getVpcSubnets({
        vpcId: 123,
        filters: [{
            name: "label",
            values: ["test"],
        }],
    });
    export const vpcSubnets = filtered_subnets.then(filtered_subnets => filtered_subnets.vpcSubnets);
    
    import pulumi
    import pulumi_linode as linode
    
    filtered_subnets = linode.get_vpc_subnets(vpc_id=123,
        filters=[{
            "name": "label",
            "values": ["test"],
        }])
    pulumi.export("vpcSubnets", filtered_subnets.vpc_subnets)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-linode/sdk/v5/go/linode"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		filtered_subnets, err := linode.GetVpcSubnets(ctx, &linode.GetVpcSubnetsArgs{
    			VpcId: 123,
    			Filters: []linode.GetVpcSubnetsFilter{
    				{
    					Name: "label",
    					Values: []string{
    						"test",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vpcSubnets", filtered_subnets.VpcSubnets)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Linode = Pulumi.Linode;
    
    return await Deployment.RunAsync(() => 
    {
        var filtered_subnets = Linode.GetVpcSubnets.Invoke(new()
        {
            VpcId = 123,
            Filters = new[]
            {
                new Linode.Inputs.GetVpcSubnetsFilterInputArgs
                {
                    Name = "label",
                    Values = new[]
                    {
                        "test",
                    },
                },
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["vpcSubnets"] = filtered_subnets.Apply(filtered_subnets => filtered_subnets.Apply(getVpcSubnetsResult => getVpcSubnetsResult.VpcSubnets)),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.linode.LinodeFunctions;
    import com.pulumi.linode.inputs.GetVpcSubnetsArgs;
    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) {
            final var filtered-subnets = LinodeFunctions.getVpcSubnets(GetVpcSubnetsArgs.builder()
                .vpcId(123)
                .filters(GetVpcSubnetsFilterArgs.builder()
                    .name("label")
                    .values("test")
                    .build())
                .build());
    
            ctx.export("vpcSubnets", filtered_subnets.vpcSubnets());
        }
    }
    
    variables:
      filtered-subnets:
        fn::invoke:
          function: linode:getVpcSubnets
          arguments:
            vpcId: 123
            filters:
              - name: label
                values:
                  - test
    outputs:
      vpcSubnets: ${["filtered-subnets"].vpcSubnets}
    

    IPv6

    Limited Availability IPv6 VPCs may not currently be available to all users.

    The following attributes are exported under each entry of the ipv6 field:

    • range - An IPv6 range allocated to this subnet in CIDR format.

    Filterable Fields

    • id

    • label

    • ipv4

    Using getVpcSubnets

    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 getVpcSubnets(args: GetVpcSubnetsArgs, opts?: InvokeOptions): Promise<GetVpcSubnetsResult>
    function getVpcSubnetsOutput(args: GetVpcSubnetsOutputArgs, opts?: InvokeOptions): Output<GetVpcSubnetsResult>
    def get_vpc_subnets(filters: Optional[Sequence[GetVpcSubnetsFilter]] = None,
                        vpc_id: Optional[int] = None,
                        opts: Optional[InvokeOptions] = None) -> GetVpcSubnetsResult
    def get_vpc_subnets_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetVpcSubnetsFilterArgs]]]] = None,
                        vpc_id: Optional[pulumi.Input[int]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetVpcSubnetsResult]
    func GetVpcSubnets(ctx *Context, args *GetVpcSubnetsArgs, opts ...InvokeOption) (*GetVpcSubnetsResult, error)
    func GetVpcSubnetsOutput(ctx *Context, args *GetVpcSubnetsOutputArgs, opts ...InvokeOption) GetVpcSubnetsResultOutput

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

    public static class GetVpcSubnets 
    {
        public static Task<GetVpcSubnetsResult> InvokeAsync(GetVpcSubnetsArgs args, InvokeOptions? opts = null)
        public static Output<GetVpcSubnetsResult> Invoke(GetVpcSubnetsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVpcSubnetsResult> getVpcSubnets(GetVpcSubnetsArgs args, InvokeOptions options)
    public static Output<GetVpcSubnetsResult> getVpcSubnets(GetVpcSubnetsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: linode:index/getVpcSubnets:getVpcSubnets
      arguments:
        # arguments dictionary

    The following arguments are supported:

    VpcId int
    The id of the parent VPC for the list of VPCs.

    • filter - (Optional) A set of filters used to select Linode VPC subnets that meet certain requirements.
    Filters List<GetVpcSubnetsFilter>
    VpcId int
    The id of the parent VPC for the list of VPCs.

    • filter - (Optional) A set of filters used to select Linode VPC subnets that meet certain requirements.
    Filters []GetVpcSubnetsFilter
    vpcId Integer
    The id of the parent VPC for the list of VPCs.

    • filter - (Optional) A set of filters used to select Linode VPC subnets that meet certain requirements.
    filters List<GetVpcSubnetsFilter>
    vpcId number
    The id of the parent VPC for the list of VPCs.

    • filter - (Optional) A set of filters used to select Linode VPC subnets that meet certain requirements.
    filters GetVpcSubnetsFilter[]
    vpc_id int
    The id of the parent VPC for the list of VPCs.

    • filter - (Optional) A set of filters used to select Linode VPC subnets that meet certain requirements.
    filters Sequence[GetVpcSubnetsFilter]
    vpcId Number
    The id of the parent VPC for the list of VPCs.

    • filter - (Optional) A set of filters used to select Linode VPC subnets that meet certain requirements.
    filters List<Property Map>

    getVpcSubnets Result

    The following output properties are available:

    Supporting Types

    GetVpcSubnetsFilter

    Name string
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    Values 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 string
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    Values []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 String
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    values 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 string
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    values 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 str
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    values 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 String
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    values 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)

    GetVpcSubnetsVpcSubnet

    Created string
    The date and time when the VPC Subnet was created.
    Id int
    ID of the interface.
    Ipv4 string
    The IPv4 range of this subnet in CIDR format.
    Ipv6s List<GetVpcSubnetsVpcSubnetIpv6>
    The IPv6 ranges of this subnet.
    Label string
    The label of the VPC subnet.
    Linodes List<GetVpcSubnetsVpcSubnetLinode>
    A list of Linodes added to this subnet.
    Updated string
    The date and time when the VPC Subnet was last updated.
    Created string
    The date and time when the VPC Subnet was created.
    Id int
    ID of the interface.
    Ipv4 string
    The IPv4 range of this subnet in CIDR format.
    Ipv6s []GetVpcSubnetsVpcSubnetIpv6
    The IPv6 ranges of this subnet.
    Label string
    The label of the VPC subnet.
    Linodes []GetVpcSubnetsVpcSubnetLinode
    A list of Linodes added to this subnet.
    Updated string
    The date and time when the VPC Subnet was last updated.
    created String
    The date and time when the VPC Subnet was created.
    id Integer
    ID of the interface.
    ipv4 String
    The IPv4 range of this subnet in CIDR format.
    ipv6s List<GetVpcSubnetsVpcSubnetIpv6>
    The IPv6 ranges of this subnet.
    label String
    The label of the VPC subnet.
    linodes List<GetVpcSubnetsVpcSubnetLinode>
    A list of Linodes added to this subnet.
    updated String
    The date and time when the VPC Subnet was last updated.
    created string
    The date and time when the VPC Subnet was created.
    id number
    ID of the interface.
    ipv4 string
    The IPv4 range of this subnet in CIDR format.
    ipv6s GetVpcSubnetsVpcSubnetIpv6[]
    The IPv6 ranges of this subnet.
    label string
    The label of the VPC subnet.
    linodes GetVpcSubnetsVpcSubnetLinode[]
    A list of Linodes added to this subnet.
    updated string
    The date and time when the VPC Subnet was last updated.
    created str
    The date and time when the VPC Subnet was created.
    id int
    ID of the interface.
    ipv4 str
    The IPv4 range of this subnet in CIDR format.
    ipv6s Sequence[GetVpcSubnetsVpcSubnetIpv6]
    The IPv6 ranges of this subnet.
    label str
    The label of the VPC subnet.
    linodes Sequence[GetVpcSubnetsVpcSubnetLinode]
    A list of Linodes added to this subnet.
    updated str
    The date and time when the VPC Subnet was last updated.
    created String
    The date and time when the VPC Subnet was created.
    id Number
    ID of the interface.
    ipv4 String
    The IPv4 range of this subnet in CIDR format.
    ipv6s List<Property Map>
    The IPv6 ranges of this subnet.
    label String
    The label of the VPC subnet.
    linodes List<Property Map>
    A list of Linodes added to this subnet.
    updated String
    The date and time when the VPC Subnet was last updated.

    GetVpcSubnetsVpcSubnetIpv6

    Range string
    An IPv6 range allocated to this subnet.
    Range string
    An IPv6 range allocated to this subnet.
    range String
    An IPv6 range allocated to this subnet.
    range string
    An IPv6 range allocated to this subnet.
    range str
    An IPv6 range allocated to this subnet.
    range String
    An IPv6 range allocated to this subnet.

    GetVpcSubnetsVpcSubnetLinode

    Id int
    ID of the interface.
    Interfaces List<GetVpcSubnetsVpcSubnetLinodeInterface>
    A list of networking interfaces objects.
    Id int
    ID of the interface.
    Interfaces []GetVpcSubnetsVpcSubnetLinodeInterface
    A list of networking interfaces objects.
    id Integer
    ID of the interface.
    interfaces List<GetVpcSubnetsVpcSubnetLinodeInterface>
    A list of networking interfaces objects.
    id number
    ID of the interface.
    interfaces GetVpcSubnetsVpcSubnetLinodeInterface[]
    A list of networking interfaces objects.
    id int
    ID of the interface.
    interfaces Sequence[GetVpcSubnetsVpcSubnetLinodeInterface]
    A list of networking interfaces objects.
    id Number
    ID of the interface.
    interfaces List<Property Map>
    A list of networking interfaces objects.

    GetVpcSubnetsVpcSubnetLinodeInterface

    Active bool
    Whether the Interface is actively in use.
    ConfigId int
    ID of Linode Config that the interface is associated with. null for a Linode Interface.
    Id int
    ID of the interface.
    Active bool
    Whether the Interface is actively in use.
    ConfigId int
    ID of Linode Config that the interface is associated with. null for a Linode Interface.
    Id int
    ID of the interface.
    active Boolean
    Whether the Interface is actively in use.
    configId Integer
    ID of Linode Config that the interface is associated with. null for a Linode Interface.
    id Integer
    ID of the interface.
    active boolean
    Whether the Interface is actively in use.
    configId number
    ID of Linode Config that the interface is associated with. null for a Linode Interface.
    id number
    ID of the interface.
    active bool
    Whether the Interface is actively in use.
    config_id int
    ID of Linode Config that the interface is associated with. null for a Linode Interface.
    id int
    ID of the interface.
    active Boolean
    Whether the Interface is actively in use.
    configId Number
    ID of Linode Config that the interface is associated with. null for a Linode Interface.
    id Number
    ID of the interface.

    Package Details

    Repository
    Linode pulumi/pulumi-linode
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the linode Terraform Provider.
    linode logo
    Linode v5.7.0 published on Saturday, Jan 17, 2026 by Pulumi
      Meet Neo: Your AI Platform Teammate