getNetworks

This data source provides VPCs available to the user.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const vpcsDs = alicloud.vpc.getNetworks({
cidrBlock: "172.16.0.0/12",
status: "Available",
nameRegex: "^foo",
});
export const firstVpcId = vpcsDs.then(vpcsDs => vpcsDs.vpcs?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
vpcs_ds = alicloud.vpc.get_networks(cidr_block="172.16.0.0/12",
status="Available",
name_regex="^foo")
pulumi.export("firstVpcId", vpcs_ds.vpcs[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var vpcsDs = AliCloud.Vpc.GetNetworks.Invoke(new()
{
CidrBlock = "172.16.0.0/12",
Status = "Available",
NameRegex = "^foo",
});
return new Dictionary<string, object?>
{
["firstVpcId"] = vpcsDs&#46;Apply(getNetworksResult => getNetworksResult&#46;Vpcs[0]?.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
vpcsDs, err := vpc.GetNetworks(ctx, &vpc.GetNetworksArgs{
CidrBlock: pulumi.StringRef("172.16.0.0/12"),
Status: pulumi.StringRef("Available"),
NameRegex: pulumi.StringRef("^foo"),
}, nil)
if err != nil {
return err
}
ctx.Export("firstVpcId", vpcsDs.Vpcs[0].Id)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.vpc.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs;
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 vpcsDs = VpcFunctions.getNetworks(GetNetworksArgs.builder()
.cidrBlock("172.16.0.0/12")
.status("Available")
.nameRegex("^foo")
.build());
ctx.export("firstVpcId", vpcsDs.applyValue(getNetworksResult -> getNetworksResult.vpcs()[0].id()));
}
}
variables:
vpcsDs:
fn::invoke:
function: alicloud:vpc:getNetworks
arguments:
cidrBlock: 172.16.0.0/12
status: Available
nameRegex: ^foo
outputs:
firstVpcId: ${vpcsDs.vpcs[0].id}

Return

A collection of values returned by getNetworks.

Parameters

argument

A collection of arguments for invoking getNetworks.


suspend fun getNetworks(cidrBlock: String? = null, dhcpOptionsSetId: String? = null, dryRun: Boolean? = null, enableDetails: Boolean? = null, ids: List<String>? = null, isDefault: Boolean? = null, nameRegex: String? = null, outputFile: String? = null, pageNumber: Int? = null, pageSize: Int? = null, resourceGroupId: String? = null, status: String? = null, tags: Map<String, String>? = null, vpcName: String? = null, vpcOwnerId: Int? = null, vswitchId: String? = null): GetNetworksResult

Return

A collection of values returned by getNetworks.

Parameters

cidrBlock

Filter results by a specific CIDR block. For example: "172.16.0.0/12".

dhcpOptionsSetId

The ID of dhcp options set.

dryRun

Indicates whether to check this request only. Valid values: true and false.

enableDetails

Default to true. Set it to true can output the route_table_id.

ids

A list of VPC IDs.

isDefault

Indicate whether the VPC is the default one in the specified region.

nameRegex

A regex string to filter VPCs by name.

outputFile

File name where to save data source results (after running pulumi preview).

pageNumber
pageSize
resourceGroupId

The Id of resource group which VPC belongs.

status

Filter results by a specific status. Valid value are Pending and Available.

tags

A mapping of tags to assign to the resource.

vpcName

The name of the VPC.

vpcOwnerId

The owner ID of VPC.

vswitchId

Filter results by the specified vSwitch.

See also


suspend fun getNetworks(argument: suspend GetNetworksPlainArgsBuilder.() -> Unit): GetNetworksResult

Return

A collection of values returned by getNetworks.

Parameters

argument

Builder for com.pulumi.alicloud.vpc.kotlin.inputs.GetNetworksPlainArgs.

See also