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 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);
Copy
import pulumi
import pulumi_ucloud as ucloud

example = ucloud.get_vpcs()
pulumi.export("first", example.vpcs[0].id)
Copy
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
	})
}
Copy
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),
    };
});
Copy
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()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: ucloud:getVpcs
      arguments: {}
outputs:
  first: ${example.vpcs[0].id}
Copy

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>
Copy
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]
Copy
func GetVpcs(ctx *Context, args *GetVpcsArgs, opts ...InvokeOption) (*GetVpcsResult, error)
func GetVpcsOutput(ctx *Context, args *GetVpcsOutputArgs, opts ...InvokeOption) GetVpcsResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetVpcsResult> getVpcs(GetVpcsArgs args, InvokeOptions options)
public static Output<GetVpcsResult> getVpcs(GetVpcsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: ucloud:index/getVpcs:getVpcs
  arguments:
    # arguments dictionary
Copy

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 This property is required. List<string>
The CIDR blocks of VPC.
CreateTime This property is required. string
The time of creation for VPC, formatted in RFC3339 time string.
Id This property is required. string
The ID of VPC.
Name This property is required. string
The name of VPC.
Tag This property is required. string
A tag assigned to VPC.
UpdateTime This property is required. string
The time whenever there is a change made to VPC, formatted in RFC3339 time string.
CidrBlocks This property is required. []string
The CIDR blocks of VPC.
CreateTime This property is required. string
The time of creation for VPC, formatted in RFC3339 time string.
Id This property is required. string
The ID of VPC.
Name This property is required. string
The name of VPC.
Tag This property is required. string
A tag assigned to VPC.
UpdateTime This property is required. string
The time whenever there is a change made to VPC, formatted in RFC3339 time string.
cidrBlocks This property is required. List<String>
The CIDR blocks of VPC.
createTime This property is required. String
The time of creation for VPC, formatted in RFC3339 time string.
id This property is required. String
The ID of VPC.
name This property is required. String
The name of VPC.
tag This property is required. String
A tag assigned to VPC.
updateTime This property is required. String
The time whenever there is a change made to VPC, formatted in RFC3339 time string.
cidrBlocks This property is required. string[]
The CIDR blocks of VPC.
createTime This property is required. string
The time of creation for VPC, formatted in RFC3339 time string.
id This property is required. string
The ID of VPC.
name This property is required. string
The name of VPC.
tag This property is required. string
A tag assigned to VPC.
updateTime This property is required. string
The time whenever there is a change made to VPC, formatted in RFC3339 time string.
cidr_blocks This property is required. Sequence[str]
The CIDR blocks of VPC.
create_time This property is required. str
The time of creation for VPC, formatted in RFC3339 time string.
id This property is required. str
The ID of VPC.
name This property is required. str
The name of VPC.
tag This property is required. str
A tag assigned to VPC.
update_time This property is required. str
The time whenever there is a change made to VPC, formatted in RFC3339 time string.
cidrBlocks This property is required. List<String>
The CIDR blocks of VPC.
createTime This property is required. String
The time of creation for VPC, formatted in RFC3339 time string.
id This property is required. String
The ID of VPC.
name This property is required. String
The name of VPC.
tag This property is required. String
A tag assigned to VPC.
updateTime This property is required. 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 1.39.1 published on Monday, Apr 14, 2025 by ucloud