1. Packages
  2. Ucloud Provider
  3. API Docs
  4. getVpcs
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

ucloud.getVpcs

Explore with Pulumi AI

ucloud logo
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

    This data source provides a list of VPC resources according to their VPC ID, name.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ucloud from "@pulumi/ucloud";
    
    const example = ucloud.getVpcs({});
    export const first = example.then(example => example.vpcs?.[0]?.id);
    
    import pulumi
    import pulumi_ucloud as ucloud
    
    example = ucloud.get_vpcs()
    pulumi.export("first", example.vpcs[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ucloud/ucloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := ucloud.GetVpcs(ctx, &ucloud.GetVpcsArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("first", example.Vpcs[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ucloud = Pulumi.Ucloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ucloud.GetVpcs.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["first"] = example.Apply(getVpcsResult => getVpcsResult.Vpcs[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ucloud.UcloudFunctions;
    import com.pulumi.ucloud.inputs.GetVpcsArgs;
    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 example = UcloudFunctions.getVpcs();
    
            ctx.export("first", example.applyValue(getVpcsResult -> getVpcsResult.vpcs()[0].id()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ucloud:getVpcs
          arguments: {}
    outputs:
      first: ${example.vpcs[0].id}
    

    Using getVpcs

    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 getVpcs(args: GetVpcsArgs, opts?: InvokeOptions): Promise<GetVpcsResult>
    function getVpcsOutput(args: GetVpcsOutputArgs, opts?: InvokeOptions): Output<GetVpcsResult>
    def get_vpcs(id: Optional[str] = None,
                 ids: Optional[Sequence[str]] = None,
                 name_regex: Optional[str] = None,
                 output_file: Optional[str] = None,
                 tag: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetVpcsResult
    def get_vpcs_output(id: Optional[pulumi.Input[str]] = None,
                 ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 name_regex: Optional[pulumi.Input[str]] = None,
                 output_file: Optional[pulumi.Input[str]] = None,
                 tag: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetVpcsResult]
    func GetVpcs(ctx *Context, args *GetVpcsArgs, opts ...InvokeOption) (*GetVpcsResult, error)
    func GetVpcsOutput(ctx *Context, args *GetVpcsOutputArgs, opts ...InvokeOption) GetVpcsResultOutput

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

    public static class GetVpcs 
    {
        public static Task<GetVpcsResult> InvokeAsync(GetVpcsArgs args, InvokeOptions? opts = null)
        public static Output<GetVpcsResult> Invoke(GetVpcsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVpcsResult> getVpcs(GetVpcsArgs args, InvokeOptions options)
    public static Output<GetVpcsResult> getVpcs(GetVpcsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ucloud:index/getVpcs:getVpcs
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    The ID of VPC.
    Ids List<string>
    A list of VPC IDs, all the VPC resources belong to this region will be retrieved if the ID is [].
    NameRegex string
    A regex string to filter resulting VPC resources by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Tag string
    A tag assigned to VPC.
    Id string
    The ID of VPC.
    Ids []string
    A list of VPC IDs, all the VPC resources belong to this region will be retrieved if the ID is [].
    NameRegex string
    A regex string to filter resulting VPC resources by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Tag string
    A tag assigned to VPC.
    id String
    The ID of VPC.
    ids List<String>
    A list of VPC IDs, all the VPC resources belong to this region will be retrieved if the ID is [].
    nameRegex String
    A regex string to filter resulting VPC resources by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    tag String
    A tag assigned to VPC.
    id string
    The ID of VPC.
    ids string[]
    A list of VPC IDs, all the VPC resources belong to this region will be retrieved if the ID is [].
    nameRegex string
    A regex string to filter resulting VPC resources by name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    tag string
    A tag assigned to VPC.
    id str
    The ID of VPC.
    ids Sequence[str]
    A list of VPC IDs, all the VPC resources belong to this region will be retrieved if the ID is [].
    name_regex str
    A regex string to filter resulting VPC resources by name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    tag str
    A tag assigned to VPC.
    id String
    The ID of VPC.
    ids List<String>
    A list of VPC IDs, all the VPC resources belong to this region will be retrieved if the ID is [].
    nameRegex String
    A regex string to filter resulting VPC resources by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    tag String
    A tag assigned to VPC.

    getVpcs Result

    The following output properties are available:

    Id string
    The ID of VPC.
    Ids List<string>
    TotalCount double
    Total number of VPC resources that satisfy the condition.
    Vpcs List<GetVpcsVpc>
    It is a nested type which documented below.
    NameRegex string
    OutputFile string
    Tag string
    A tag assigned to VPC.
    Id string
    The ID of VPC.
    Ids []string
    TotalCount float64
    Total number of VPC resources that satisfy the condition.
    Vpcs []GetVpcsVpc
    It is a nested type which documented below.
    NameRegex string
    OutputFile string
    Tag string
    A tag assigned to VPC.
    id String
    The ID of VPC.
    ids List<String>
    totalCount Double
    Total number of VPC resources that satisfy the condition.
    vpcs List<GetVpcsVpc>
    It is a nested type which documented below.
    nameRegex String
    outputFile String
    tag String
    A tag assigned to VPC.
    id string
    The ID of VPC.
    ids string[]
    totalCount number
    Total number of VPC resources that satisfy the condition.
    vpcs GetVpcsVpc[]
    It is a nested type which documented below.
    nameRegex string
    outputFile string
    tag string
    A tag assigned to VPC.
    id str
    The ID of VPC.
    ids Sequence[str]
    total_count float
    Total number of VPC resources that satisfy the condition.
    vpcs Sequence[GetVpcsVpc]
    It is a nested type which documented below.
    name_regex str
    output_file str
    tag str
    A tag assigned to VPC.
    id String
    The ID of VPC.
    ids List<String>
    totalCount Number
    Total number of VPC resources that satisfy the condition.
    vpcs List<Property Map>
    It is a nested type which documented below.
    nameRegex String
    outputFile String
    tag String
    A tag assigned to VPC.

    Supporting Types

    GetVpcsVpc

    CidrBlocks List<string>
    The CIDR blocks of VPC.
    CreateTime string
    The time of creation for VPC, formatted in RFC3339 time string.
    Id string
    The ID of VPC.
    Name string
    The name of VPC.
    Tag string
    A tag assigned to VPC.
    UpdateTime string
    The time whenever there is a change made to VPC, formatted in RFC3339 time string.
    CidrBlocks []string
    The CIDR blocks of VPC.
    CreateTime string
    The time of creation for VPC, formatted in RFC3339 time string.
    Id string
    The ID of VPC.
    Name string
    The name of VPC.
    Tag string
    A tag assigned to VPC.
    UpdateTime string
    The time whenever there is a change made to VPC, formatted in RFC3339 time string.
    cidrBlocks List<String>
    The CIDR blocks of VPC.
    createTime String
    The time of creation for VPC, formatted in RFC3339 time string.
    id String
    The ID of VPC.
    name String
    The name of VPC.
    tag String
    A tag assigned to VPC.
    updateTime String
    The time whenever there is a change made to VPC, formatted in RFC3339 time string.
    cidrBlocks string[]
    The CIDR blocks of VPC.
    createTime string
    The time of creation for VPC, formatted in RFC3339 time string.
    id string
    The ID of VPC.
    name string
    The name of VPC.
    tag string
    A tag assigned to VPC.
    updateTime string
    The time whenever there is a change made to VPC, formatted in RFC3339 time string.
    cidr_blocks Sequence[str]
    The CIDR blocks of VPC.
    create_time str
    The time of creation for VPC, formatted in RFC3339 time string.
    id str
    The ID of VPC.
    name str
    The name of VPC.
    tag str
    A tag assigned to VPC.
    update_time str
    The time whenever there is a change made to VPC, formatted in RFC3339 time string.
    cidrBlocks List<String>
    The CIDR blocks of VPC.
    createTime String
    The time of creation for VPC, formatted in RFC3339 time string.
    id String
    The ID of VPC.
    name String
    The name of VPC.
    tag String
    A tag assigned to VPC.
    updateTime String
    The time whenever there is a change made to VPC, formatted in RFC3339 time string.

    Package Details

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