ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud
ucloud.getVpcs
Explore with Pulumi AI
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
[]
. - Name
Regex string - A regex string to filter resulting VPC resources by name.
- Output
File 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
[]
. - Name
Regex string - A regex string to filter resulting VPC resources by name.
- Output
File 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
[]
. - name
Regex String - A regex string to filter resulting VPC resources by name.
- output
File 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
[]
. - name
Regex string - A regex string to filter resulting VPC resources by name.
- output
File 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
[]
. - name
Regex String - A regex string to filter resulting VPC resources by name.
- output
File 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>
- Total
Count double - Total number of VPC resources that satisfy the condition.
- Vpcs
List<Get
Vpcs Vpc> - It is a nested type which documented below.
- Name
Regex string - Output
File string - Tag string
- A tag assigned to VPC.
- Id string
- The ID of VPC.
- Ids []string
- Total
Count float64 - Total number of VPC resources that satisfy the condition.
- Vpcs
[]Get
Vpcs Vpc - It is a nested type which documented below.
- Name
Regex string - Output
File string - Tag string
- A tag assigned to VPC.
- id String
- The ID of VPC.
- ids List<String>
- total
Count Double - Total number of VPC resources that satisfy the condition.
- vpcs
List<Get
Vpcs Vpc> - It is a nested type which documented below.
- name
Regex String - output
File String - tag String
- A tag assigned to VPC.
- id string
- The ID of VPC.
- ids string[]
- total
Count number - Total number of VPC resources that satisfy the condition.
- vpcs
Get
Vpcs Vpc[] - It is a nested type which documented below.
- name
Regex string - output
File 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[Get
Vpcs Vpc] - 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>
- total
Count Number - Total number of VPC resources that satisfy the condition.
- vpcs List<Property Map>
- It is a nested type which documented below.
- name
Regex String - output
File String - tag String
- A tag assigned to VPC.
Supporting Types
GetVpcsVpc
- Cidr
Blocks List<string> - The CIDR blocks of VPC.
- Create
Time 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.
- Update
Time string - The time whenever there is a change made to VPC, formatted in RFC3339 time string.
- Cidr
Blocks []string - The CIDR blocks of VPC.
- Create
Time 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.
- Update
Time string - The time whenever there is a change made to VPC, formatted in RFC3339 time string.
- cidr
Blocks List<String> - The CIDR blocks of VPC.
- create
Time 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.
- update
Time String - The time whenever there is a change made to VPC, formatted in RFC3339 time string.
- cidr
Blocks string[] - The CIDR blocks of VPC.
- create
Time 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.
- update
Time 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.
- cidr
Blocks List<String> - The CIDR blocks of VPC.
- create
Time 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.
- update
Time 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.