1. Packages
  2. Linode
  3. API Docs
  4. getVpcSubnets
Linode v4.22.1 published on Wednesday, Jul 3, 2024 by Pulumi

linode.getVpcSubnets

Explore with Pulumi AI

linode logo
Linode v4.22.1 published on Wednesday, Jul 3, 2024 by Pulumi

    Provides information about a list of Linode VPC subnets that match a set of filters.

    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=[linode.GetVpcSubnetsFilterArgs(
            name="label",
            values=["test"],
        )])
    pulumi.export("vpcSubnets", filtered_subnets.vpc_subnets)
    
    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 {
    		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}
    

    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,
                        vpc_subnets: Optional[Sequence[GetVpcSubnetsVpcSubnet]] = 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,
                        vpc_subnets: Optional[pulumi.Input[Sequence[pulumi.Input[GetVpcSubnetsVpcSubnetArgs]]]] = 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)
    // Output-based functions aren't available in Java yet
    
    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>
    VpcSubnets List<GetVpcSubnetsVpcSubnet>
    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
    VpcSubnets []GetVpcSubnetsVpcSubnet
    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>
    vpcSubnets List<GetVpcSubnetsVpcSubnet>
    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[]
    vpcSubnets GetVpcSubnetsVpcSubnet[]
    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]
    vpc_subnets Sequence[GetVpcSubnetsVpcSubnet]
    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>
    vpcSubnets List<Property Map>

    getVpcSubnets Result

    The following output properties are available:

    id string
    The unique id of the VPC subnet.
    vpcId number
    filters GetVpcSubnetsFilter[]
    vpcSubnets GetVpcSubnetsVpcSubnet[]
    id String
    The unique id of the VPC subnet.
    vpcId Number
    filters List<Property Map>
    vpcSubnets List<Property Map>

    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
    The unique id of the VPC subnet.
    Ipv4 string
    The IPv4 range of this subnet in CIDR format.
    Label string
    The label of the VPC subnet.
    Linodes List<GetVpcSubnetsVpcSubnetLinode>
    A list of Linode IDs that 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
    The unique id of the VPC subnet.
    Ipv4 string
    The IPv4 range of this subnet in CIDR format.
    Label string
    The label of the VPC subnet.
    Linodes []GetVpcSubnetsVpcSubnetLinode
    A list of Linode IDs that 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
    The unique id of the VPC subnet.
    ipv4 String
    The IPv4 range of this subnet in CIDR format.
    label String
    The label of the VPC subnet.
    linodes List<GetVpcSubnetsVpcSubnetLinode>
    A list of Linode IDs that 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
    The unique id of the VPC subnet.
    ipv4 string
    The IPv4 range of this subnet in CIDR format.
    label string
    The label of the VPC subnet.
    linodes GetVpcSubnetsVpcSubnetLinode[]
    A list of Linode IDs that 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
    The unique id of the VPC subnet.
    ipv4 str
    The IPv4 range of this subnet in CIDR format.
    label str
    The label of the VPC subnet.
    linodes Sequence[GetVpcSubnetsVpcSubnetLinode]
    A list of Linode IDs that 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
    The unique id of the VPC subnet.
    ipv4 String
    The IPv4 range of this subnet in CIDR format.
    label String
    The label of the VPC subnet.
    linodes List<Property Map>
    A list of Linode IDs that added to this subnet.
    updated String
    The date and time when the VPC Subnet was last updated.

    GetVpcSubnetsVpcSubnetLinode

    Id int
    The unique id of the VPC subnet.
    Interfaces List<GetVpcSubnetsVpcSubnetLinodeInterface>
    Id int
    The unique id of the VPC subnet.
    Interfaces []GetVpcSubnetsVpcSubnetLinodeInterface
    id Integer
    The unique id of the VPC subnet.
    interfaces List<GetVpcSubnetsVpcSubnetLinodeInterface>
    id number
    The unique id of the VPC subnet.
    interfaces GetVpcSubnetsVpcSubnetLinodeInterface[]
    id Number
    The unique id of the VPC subnet.
    interfaces List<Property Map>

    GetVpcSubnetsVpcSubnetLinodeInterface

    Active bool
    Id int
    The unique id of the VPC subnet.
    Active bool
    Id int
    The unique id of the VPC subnet.
    active Boolean
    id Integer
    The unique id of the VPC subnet.
    active boolean
    id number
    The unique id of the VPC subnet.
    active bool
    id int
    The unique id of the VPC subnet.
    active Boolean
    id Number
    The unique id of the VPC subnet.

    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 v4.22.1 published on Wednesday, Jul 3, 2024 by Pulumi