1. Packages
  2. Opentelekomcloud Provider
  3. API Docs
  4. getVpcSubnetIdsV1
opentelekomcloud 1.36.35 published on Monday, Apr 14, 2025 by opentelekomcloud

opentelekomcloud.getVpcSubnetIdsV1

Explore with Pulumi AI

opentelekomcloud logo
opentelekomcloud 1.36.35 published on Monday, Apr 14, 2025 by opentelekomcloud

    Up-to-date reference of API arguments for VPC subnet you can get at documentation portal

    Use this data source to get a list of subnet ids for a vpc_id

    This resource can be useful for getting back a list of subnet ids for a VPC.

    Example Usage

    The following example shows outputting all cidr blocks for every subnet id in a VPC.

    import * as pulumi from "@pulumi/pulumi";
    import * as opentelekomcloud from "@pulumi/opentelekomcloud";
    
    const subnetIds = opentelekomcloud.getVpcSubnetIdsV1({
        vpcId: _var.vpc_id,
    });
    const subnet = subnetIds.then(subnetIds => .map(([__key, __value]) => (opentelekomcloud.getVpcSubnetV1({
        id: __value,
    }))));
    export const subnetCidrBlocks = subnet.map(s => (s.cidr));
    
    import pulumi
    import pulumi_opentelekomcloud as opentelekomcloud
    
    subnet_ids = opentelekomcloud.get_vpc_subnet_ids_v1(vpc_id=var["vpc_id"])
    subnet = [opentelekomcloud.get_vpc_subnet_v1(id=__value) for __key, __value in subnet_ids.ids]
    pulumi.export("subnetCidrBlocks", [s.cidr for s in subnet])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/opentelekomcloud/opentelekomcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		subnetIds, err := opentelekomcloud.GetVpcSubnetIdsV1(ctx, &opentelekomcloud.GetVpcSubnetIdsV1Args{
    			VpcId: _var.Vpc_id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		subnet := "TODO: For expression"
    		ctx.Export("subnetCidrBlocks", pulumi.StringArray("TODO: For expression"))
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Opentelekomcloud = Pulumi.Opentelekomcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var subnetIds = Opentelekomcloud.GetVpcSubnetIdsV1.Invoke(new()
        {
            VpcId = @var.Vpc_id,
        });
    
        var subnet = .Select(__value => 
        {
            return Opentelekomcloud.GetVpcSubnetV1.Invoke(new()
            {
                Id = __value,
            });
        }).ToList();
    
        return new Dictionary<string, object?>
        {
            ["subnetCidrBlocks"] = subnet,
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.opentelekomcloud.OpentelekomcloudFunctions;
    import com.pulumi.opentelekomcloud.inputs.GetVpcSubnetIdsV1Args;
    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 subnetIds = OpentelekomcloudFunctions.getVpcSubnetIdsV1(GetVpcSubnetIdsV1Args.builder()
                .vpcId(var_.vpc_id())
                .build());
    
            final var subnet = "TODO: ForExpression";
    
            ctx.export("subnetCidrBlocks", "TODO: ForExpression");
        }
    }
    
    Coming soon!
    

    Using getVpcSubnetIdsV1

    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 getVpcSubnetIdsV1(args: GetVpcSubnetIdsV1Args, opts?: InvokeOptions): Promise<GetVpcSubnetIdsV1Result>
    function getVpcSubnetIdsV1Output(args: GetVpcSubnetIdsV1OutputArgs, opts?: InvokeOptions): Output<GetVpcSubnetIdsV1Result>
    def get_vpc_subnet_ids_v1(id: Optional[str] = None,
                              region: Optional[str] = None,
                              vpc_id: Optional[str] = None,
                              opts: Optional[InvokeOptions] = None) -> GetVpcSubnetIdsV1Result
    def get_vpc_subnet_ids_v1_output(id: Optional[pulumi.Input[str]] = None,
                              region: Optional[pulumi.Input[str]] = None,
                              vpc_id: Optional[pulumi.Input[str]] = None,
                              opts: Optional[InvokeOptions] = None) -> Output[GetVpcSubnetIdsV1Result]
    func GetVpcSubnetIdsV1(ctx *Context, args *GetVpcSubnetIdsV1Args, opts ...InvokeOption) (*GetVpcSubnetIdsV1Result, error)
    func GetVpcSubnetIdsV1Output(ctx *Context, args *GetVpcSubnetIdsV1OutputArgs, opts ...InvokeOption) GetVpcSubnetIdsV1ResultOutput

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

    public static class GetVpcSubnetIdsV1 
    {
        public static Task<GetVpcSubnetIdsV1Result> InvokeAsync(GetVpcSubnetIdsV1Args args, InvokeOptions? opts = null)
        public static Output<GetVpcSubnetIdsV1Result> Invoke(GetVpcSubnetIdsV1InvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVpcSubnetIdsV1Result> getVpcSubnetIdsV1(GetVpcSubnetIdsV1Args args, InvokeOptions options)
    public static Output<GetVpcSubnetIdsV1Result> getVpcSubnetIdsV1(GetVpcSubnetIdsV1Args args, InvokeOptions options)
    
    fn::invoke:
      function: opentelekomcloud:index/getVpcSubnetIdsV1:getVpcSubnetIdsV1
      arguments:
        # arguments dictionary

    The following arguments are supported:

    VpcId string
    Specifies the VPC ID used as the query filter.
    Id string
    Region string
    VpcId string
    Specifies the VPC ID used as the query filter.
    Id string
    Region string
    vpcId String
    Specifies the VPC ID used as the query filter.
    id String
    region String
    vpcId string
    Specifies the VPC ID used as the query filter.
    id string
    region string
    vpc_id str
    Specifies the VPC ID used as the query filter.
    id str
    region str
    vpcId String
    Specifies the VPC ID used as the query filter.
    id String
    region String

    getVpcSubnetIdsV1 Result

    The following output properties are available:

    Id string
    Ids List<string>
    A list of all the subnet ids found. This data source will fail if none are found.
    Region string
    VpcId string
    Id string
    Ids []string
    A list of all the subnet ids found. This data source will fail if none are found.
    Region string
    VpcId string
    id String
    ids List<String>
    A list of all the subnet ids found. This data source will fail if none are found.
    region String
    vpcId String
    id string
    ids string[]
    A list of all the subnet ids found. This data source will fail if none are found.
    region string
    vpcId string
    id str
    ids Sequence[str]
    A list of all the subnet ids found. This data source will fail if none are found.
    region str
    vpc_id str
    id String
    ids List<String>
    A list of all the subnet ids found. This data source will fail if none are found.
    region String
    vpcId String

    Package Details

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