1. Packages
  2. Flexibleengine Provider
  3. API Docs
  4. getVpcSubnetIdsV1
flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud

flexibleengine.getVpcSubnetIdsV1

Explore with Pulumi AI

flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud

Provides a list of subnet ids for a vpc_id

This data source can be useful for getting back a list of subnet ids for a vpc.

Example Usage

The following example shows outputing all cidr blocks for every subnet id in a vpc.

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

const subnetIds = flexibleengine.getVpcSubnetIdsV1({
    vpcId: _var.vpc_id,
});
const subnet = .map(__index => (flexibleengine.getVpcSubnetV1({
    id: _arg0_.ids[__index],
})));
export const subnetCidrBlocks = subnet.then(subnet => subnet.map(__item => __item.cidr));
Copy
import pulumi
import pulumi_flexibleengine as flexibleengine

subnet_ids = flexibleengine.get_vpc_subnet_ids_v1(vpc_id=var["vpc_id"])
subnet = [flexibleengine.get_vpc_subnet_v1(id=subnet_ids.ids[__index]) for __index in range(len(subnet_ids.ids))]
pulumi.export("subnetCidrBlocks", [__item.cidr for __item in subnet])
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/flexibleengine/flexibleengine"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
subnetIds, err := flexibleengine.GetVpcSubnetIdsV1(ctx, &flexibleengine.GetVpcSubnetIdsV1Args{
VpcId: _var.Vpc_id,
}, nil);
if err != nil {
return err
}
subnet := "TODO: For expression";
ctx.Export("subnetCidrBlocks", pulumi.StringArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ #-functions-%sflexibleengine:index-getVpcSubnetIdsV1:getVpcSubnetIdsV1.pp:8,11-24)))
return nil
})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Flexibleengine = Pulumi.Flexibleengine;

return await Deployment.RunAsync(() => 
{
    var subnetIds = Flexibleengine.GetVpcSubnetIdsV1.Invoke(new()
    {
        VpcId = @var.Vpc_id,
    });

    var subnet = ;

    return new Dictionary<string, object?>
    {
        ["subnetCidrBlocks"] = subnet.Apply(subnet => subnet.Select(__item => __item.Cidr).ToList()),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.flexibleengine.FlexibleengineFunctions;
import com.pulumi.flexibleengine.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 = FlexibleengineFunctions.getVpcSubnetIdsV1(GetVpcSubnetIdsV1Args.builder()
            .vpcId(var_.vpc_id())
            .build());

        final var subnet = "TODO: ForExpression";

        ctx.export("subnetCidrBlocks", subnet.stream().map(element -> element.cidr()).collect(toList()));
    }
}
Copy
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>
Copy
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]
Copy
func GetVpcSubnetIdsV1(ctx *Context, args *GetVpcSubnetIdsV1Args, opts ...InvokeOption) (*GetVpcSubnetIdsV1Result, error)
func GetVpcSubnetIdsV1Output(ctx *Context, args *GetVpcSubnetIdsV1OutputArgs, opts ...InvokeOption) GetVpcSubnetIdsV1ResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetVpcSubnetIdsV1Result> getVpcSubnetIdsV1(GetVpcSubnetIdsV1Args args, InvokeOptions options)
public static Output<GetVpcSubnetIdsV1Result> getVpcSubnetIdsV1(GetVpcSubnetIdsV1Args args, InvokeOptions options)
Copy
fn::invoke:
  function: flexibleengine:index/getVpcSubnetIdsV1:getVpcSubnetIdsV1
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

VpcId This property is required. string
Specifies the VPC ID used as the query filter.
Id string
Specifies a data source ID in UUID format.
Region string
The region in which to obtain the V1 VPC client. A VPC client is needed to retrieve VPCs. If omitted, the region argument of the provider is used.
VpcId This property is required. string
Specifies the VPC ID used as the query filter.
Id string
Specifies a data source ID in UUID format.
Region string
The region in which to obtain the V1 VPC client. A VPC client is needed to retrieve VPCs. If omitted, the region argument of the provider is used.
vpcId This property is required. String
Specifies the VPC ID used as the query filter.
id String
Specifies a data source ID in UUID format.
region String
The region in which to obtain the V1 VPC client. A VPC client is needed to retrieve VPCs. If omitted, the region argument of the provider is used.
vpcId This property is required. string
Specifies the VPC ID used as the query filter.
id string
Specifies a data source ID in UUID format.
region string
The region in which to obtain the V1 VPC client. A VPC client is needed to retrieve VPCs. If omitted, the region argument of the provider is used.
vpc_id This property is required. str
Specifies the VPC ID used as the query filter.
id str
Specifies a data source ID in UUID format.
region str
The region in which to obtain the V1 VPC client. A VPC client is needed to retrieve VPCs. If omitted, the region argument of the provider is used.
vpcId This property is required. String
Specifies the VPC ID used as the query filter.
id String
Specifies a data source ID in UUID format.
region String
The region in which to obtain the V1 VPC client. A VPC client is needed to retrieve VPCs. If omitted, the region argument of the provider is used.

getVpcSubnetIdsV1 Result

The following output properties are available:

Id string
Specifies a data source ID in UUID format.
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
Specifies a data source ID in UUID format.
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
Specifies a data source ID in UUID format.
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
Specifies a data source ID in UUID format.
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
Specifies a data source ID in UUID format.
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
Specifies a data source ID in UUID format.
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
flexibleengine flexibleenginecloud/terraform-provider-flexibleengine
License
Notes
This Pulumi package is based on the flexibleengine Terraform Provider.
flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud