Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.26.0 published on Friday, Jul 29, 2022 by Pulumi

getNetworks

This data source provides VPCs available to the user.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var vpcsDs = Output.Create(AliCloud.Vpc.GetNetworks.InvokeAsync(new AliCloud.Vpc.GetNetworksArgs
        {
            CidrBlock = "172.16.0.0/12",
            NameRegex = "^foo",
            Status = "Available",
        }));
        this.FirstVpcId = vpcsDs.Apply(vpcsDs => vpcsDs.Vpcs?[0]?.Id);
    }

    [Output("firstVpcId")]
    public Output<string> FirstVpcId { get; set; }
}
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"),
			NameRegex: pulumi.StringRef("^foo"),
			Status:    pulumi.StringRef("Available"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstVpcId", vpcsDs.Vpcs[0].Id)
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

vpcs_ds = alicloud.vpc.get_networks(cidr_block="172.16.0.0/12",
    name_regex="^foo",
    status="Available")
pulumi.export("firstVpcId", vpcs_ds.vpcs[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const vpcsDs = pulumi.output(alicloud.vpc.getNetworks({
    cidrBlock: "172.16.0.0/12",
    nameRegex: "^foo",
    status: "Available",
}));

export const firstVpcId = vpcsDs.vpcs[0].id;

Coming soon!

Using getNetworks

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 getNetworks(args: GetNetworksArgs, opts?: InvokeOptions): Promise<GetNetworksResult>
function getNetworksOutput(args: GetNetworksOutputArgs, opts?: InvokeOptions): Output<GetNetworksResult>
def get_networks(cidr_block: Optional[str] = None,
                 dhcp_options_set_id: Optional[str] = None,
                 dry_run: Optional[bool] = None,
                 enable_details: Optional[bool] = None,
                 ids: Optional[Sequence[str]] = None,
                 is_default: Optional[bool] = None,
                 name_regex: Optional[str] = None,
                 output_file: Optional[str] = None,
                 page_number: Optional[int] = None,
                 page_size: Optional[int] = None,
                 resource_group_id: Optional[str] = None,
                 status: Optional[str] = None,
                 tags: Optional[Mapping[str, Any]] = None,
                 vpc_name: Optional[str] = None,
                 vpc_owner_id: Optional[int] = None,
                 vswitch_id: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetNetworksResult
def get_networks_output(cidr_block: Optional[pulumi.Input[str]] = None,
                 dhcp_options_set_id: Optional[pulumi.Input[str]] = None,
                 dry_run: Optional[pulumi.Input[bool]] = None,
                 enable_details: Optional[pulumi.Input[bool]] = None,
                 ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 is_default: Optional[pulumi.Input[bool]] = None,
                 name_regex: Optional[pulumi.Input[str]] = None,
                 output_file: Optional[pulumi.Input[str]] = None,
                 page_number: Optional[pulumi.Input[int]] = None,
                 page_size: Optional[pulumi.Input[int]] = None,
                 resource_group_id: Optional[pulumi.Input[str]] = None,
                 status: Optional[pulumi.Input[str]] = None,
                 tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
                 vpc_name: Optional[pulumi.Input[str]] = None,
                 vpc_owner_id: Optional[pulumi.Input[int]] = None,
                 vswitch_id: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetNetworksResult]
func GetNetworks(ctx *Context, args *GetNetworksArgs, opts ...InvokeOption) (*GetNetworksResult, error)
func GetNetworksOutput(ctx *Context, args *GetNetworksOutputArgs, opts ...InvokeOption) GetNetworksResultOutput

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

public static class GetNetworks 
{
    public static Task<GetNetworksResult> InvokeAsync(GetNetworksArgs args, InvokeOptions? opts = null)
    public static Output<GetNetworksResult> Invoke(GetNetworksInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetNetworksResult> getNetworks(GetNetworksArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: alicloud:vpc/getNetworks:getNetworks
  Arguments:
    # Arguments dictionary

The following arguments are supported:

CidrBlock string

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

DhcpOptionsSetId string

The ID of dhcp options set.

DryRun bool

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

EnableDetails bool

-(Optional, Available in v1.119.0+) Default to true. Set it to true can output the route_table_id.

Ids List<string>

A list of VPC IDs.

IsDefault bool

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

NameRegex string

A regex string to filter VPCs by name.

OutputFile string
PageNumber int
PageSize int
ResourceGroupId string

The Id of resource group which VPC belongs.

Status string

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

Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

VpcName string

The name of the VPC.

VpcOwnerId int

The owner ID of VPC.

VswitchId string

Filter results by the specified VSwitch.

CidrBlock string

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

DhcpOptionsSetId string

The ID of dhcp options set.

DryRun bool

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

EnableDetails bool

-(Optional, Available in v1.119.0+) Default to true. Set it to true can output the route_table_id.

Ids []string

A list of VPC IDs.

IsDefault bool

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

NameRegex string

A regex string to filter VPCs by name.

OutputFile string
PageNumber int
PageSize int
ResourceGroupId string

The Id of resource group which VPC belongs.

Status string

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

Tags map[string]interface{}

A mapping of tags to assign to the resource.

VpcName string

The name of the VPC.

VpcOwnerId int

The owner ID of VPC.

VswitchId string

Filter results by the specified VSwitch.

cidrBlock String

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

dhcpOptionsSetId String

The ID of dhcp options set.

dryRun Boolean

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

enableDetails Boolean

-(Optional, Available in v1.119.0+) Default to true. Set it to true can output the route_table_id.

ids List<String>

A list of VPC IDs.

isDefault Boolean

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

nameRegex String

A regex string to filter VPCs by name.

outputFile String
pageNumber Integer
pageSize Integer
resourceGroupId String

The Id of resource group which VPC belongs.

status String

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

tags Map<String,Object>

A mapping of tags to assign to the resource.

vpcName String

The name of the VPC.

vpcOwnerId Integer

The owner ID of VPC.

vswitchId String

Filter results by the specified VSwitch.

cidrBlock string

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

dhcpOptionsSetId string

The ID of dhcp options set.

dryRun boolean

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

enableDetails boolean

-(Optional, Available in v1.119.0+) Default to true. Set it to true can output the route_table_id.

ids string[]

A list of VPC IDs.

isDefault boolean

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

nameRegex string

A regex string to filter VPCs by name.

outputFile string
pageNumber number
pageSize number
resourceGroupId string

The Id of resource group which VPC belongs.

status string

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

tags {[key: string]: any}

A mapping of tags to assign to the resource.

vpcName string

The name of the VPC.

vpcOwnerId number

The owner ID of VPC.

vswitchId string

Filter results by the specified VSwitch.

cidr_block str

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

dhcp_options_set_id str

The ID of dhcp options set.

dry_run bool

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

enable_details bool

-(Optional, Available in v1.119.0+) Default to true. Set it to true can output the route_table_id.

ids Sequence[str]

A list of VPC IDs.

is_default bool

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

name_regex str

A regex string to filter VPCs by name.

output_file str
page_number int
page_size int
resource_group_id str

The Id of resource group which VPC belongs.

status str

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

tags Mapping[str, Any]

A mapping of tags to assign to the resource.

vpc_name str

The name of the VPC.

vpc_owner_id int

The owner ID of VPC.

vswitch_id str

Filter results by the specified VSwitch.

cidrBlock String

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

dhcpOptionsSetId String

The ID of dhcp options set.

dryRun Boolean

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

enableDetails Boolean

-(Optional, Available in v1.119.0+) Default to true. Set it to true can output the route_table_id.

ids List<String>

A list of VPC IDs.

isDefault Boolean

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

nameRegex String

A regex string to filter VPCs by name.

outputFile String
pageNumber Number
pageSize Number
resourceGroupId String

The Id of resource group which VPC belongs.

status String

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

tags Map<Any>

A mapping of tags to assign to the resource.

vpcName String

The name of the VPC.

vpcOwnerId Number

The owner ID of VPC.

vswitchId String

Filter results by the specified VSwitch.

getNetworks Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>

A list of VPC IDs.

Names List<string>

A list of VPC names.

TotalCount int
Vpcs List<Pulumi.AliCloud.Vpc.Outputs.GetNetworksVpc>

A list of VPCs. Each element contains the following attributes:

CidrBlock string

CIDR block of the VPC.

DhcpOptionsSetId string
DryRun bool
EnableDetails bool
IsDefault bool

Whether the VPC is the default VPC in the region.

NameRegex string
OutputFile string
PageNumber int
PageSize int
ResourceGroupId string
Status string

Status of the VPC.

Tags Dictionary<string, object>

A map of tags assigned to the VPC.

VpcName string

Name of the VPC.

VpcOwnerId int
VswitchId string
Id string

The provider-assigned unique ID for this managed resource.

Ids []string

A list of VPC IDs.

Names []string

A list of VPC names.

TotalCount int
Vpcs []GetNetworksVpc

A list of VPCs. Each element contains the following attributes:

CidrBlock string

CIDR block of the VPC.

DhcpOptionsSetId string
DryRun bool
EnableDetails bool
IsDefault bool

Whether the VPC is the default VPC in the region.

NameRegex string
OutputFile string
PageNumber int
PageSize int
ResourceGroupId string
Status string

Status of the VPC.

Tags map[string]interface{}

A map of tags assigned to the VPC.

VpcName string

Name of the VPC.

VpcOwnerId int
VswitchId string
id String

The provider-assigned unique ID for this managed resource.

ids List<String>

A list of VPC IDs.

names List<String>

A list of VPC names.

totalCount Integer
vpcs List<GetNetworksVpc>

A list of VPCs. Each element contains the following attributes:

cidrBlock String

CIDR block of the VPC.

dhcpOptionsSetId String
dryRun Boolean
enableDetails Boolean
isDefault Boolean

Whether the VPC is the default VPC in the region.

nameRegex String
outputFile String
pageNumber Integer
pageSize Integer
resourceGroupId String
status String

Status of the VPC.

tags Map<String,Object>

A map of tags assigned to the VPC.

vpcName String

Name of the VPC.

vpcOwnerId Integer
vswitchId String
id string

The provider-assigned unique ID for this managed resource.

ids string[]

A list of VPC IDs.

names string[]

A list of VPC names.

totalCount number
vpcs GetNetworksVpc[]

A list of VPCs. Each element contains the following attributes:

cidrBlock string

CIDR block of the VPC.

dhcpOptionsSetId string
dryRun boolean
enableDetails boolean
isDefault boolean

Whether the VPC is the default VPC in the region.

nameRegex string
outputFile string
pageNumber number
pageSize number
resourceGroupId string
status string

Status of the VPC.

tags {[key: string]: any}

A map of tags assigned to the VPC.

vpcName string

Name of the VPC.

vpcOwnerId number
vswitchId string
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]

A list of VPC IDs.

names Sequence[str]

A list of VPC names.

total_count int
vpcs Sequence[GetNetworksVpc]

A list of VPCs. Each element contains the following attributes:

cidr_block str

CIDR block of the VPC.

dhcp_options_set_id str
dry_run bool
enable_details bool
is_default bool

Whether the VPC is the default VPC in the region.

name_regex str
output_file str
page_number int
page_size int
resource_group_id str
status str

Status of the VPC.

tags Mapping[str, Any]

A map of tags assigned to the VPC.

vpc_name str

Name of the VPC.

vpc_owner_id int
vswitch_id str
id String

The provider-assigned unique ID for this managed resource.

ids List<String>

A list of VPC IDs.

names List<String>

A list of VPC names.

totalCount Number
vpcs List<Property Map>

A list of VPCs. Each element contains the following attributes:

cidrBlock String

CIDR block of the VPC.

dhcpOptionsSetId String
dryRun Boolean
enableDetails Boolean
isDefault Boolean

Whether the VPC is the default VPC in the region.

nameRegex String
outputFile String
pageNumber Number
pageSize Number
resourceGroupId String
status String

Status of the VPC.

tags Map<Any>

A map of tags assigned to the VPC.

vpcName String

Name of the VPC.

vpcOwnerId Number
vswitchId String

Supporting Types

GetNetworksVpc

CidrBlock string

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

CreationTime string

Time of creation.

Description string

Description of the VPC

Id string

ID of the VPC.

Ipv6CidrBlock string

The IPv6 CIDR block of the VPC.

IsDefault bool

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

RegionId string

ID of the region where the VPC is located.

ResourceGroupId string

The Id of resource group which VPC belongs.

RouteTableId string

Route table ID of the VRouter.

RouterId string

The ID of the VRouter.

SecondaryCidrBlocks List<string>

A list of secondary IPv4 CIDR blocks of the VPC.

Status string

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

Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

UserCidrs List<string>

A list of user CIDRs.

VpcId string

ID of the VPC.

VpcName string

The name of the VPC.

VrouterId string

ID of the VRouter.

VswitchIds List<string>

List of VSwitch IDs in the specified VPC

CidrBlock string

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

CreationTime string

Time of creation.

Description string

Description of the VPC

Id string

ID of the VPC.

Ipv6CidrBlock string

The IPv6 CIDR block of the VPC.

IsDefault bool

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

RegionId string

ID of the region where the VPC is located.

ResourceGroupId string

The Id of resource group which VPC belongs.

RouteTableId string

Route table ID of the VRouter.

RouterId string

The ID of the VRouter.

SecondaryCidrBlocks []string

A list of secondary IPv4 CIDR blocks of the VPC.

Status string

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

Tags map[string]interface{}

A mapping of tags to assign to the resource.

UserCidrs []string

A list of user CIDRs.

VpcId string

ID of the VPC.

VpcName string

The name of the VPC.

VrouterId string

ID of the VRouter.

VswitchIds []string

List of VSwitch IDs in the specified VPC

cidrBlock String

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

creationTime String

Time of creation.

description String

Description of the VPC

id String

ID of the VPC.

ipv6CidrBlock String

The IPv6 CIDR block of the VPC.

isDefault Boolean

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

regionId String

ID of the region where the VPC is located.

resourceGroupId String

The Id of resource group which VPC belongs.

routeTableId String

Route table ID of the VRouter.

routerId String

The ID of the VRouter.

secondaryCidrBlocks List<String>

A list of secondary IPv4 CIDR blocks of the VPC.

status String

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

tags Map<String,Object>

A mapping of tags to assign to the resource.

userCidrs List<String>

A list of user CIDRs.

vpcId String

ID of the VPC.

vpcName String

The name of the VPC.

vrouterId String

ID of the VRouter.

vswitchIds List<String>

List of VSwitch IDs in the specified VPC

cidrBlock string

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

creationTime string

Time of creation.

description string

Description of the VPC

id string

ID of the VPC.

ipv6CidrBlock string

The IPv6 CIDR block of the VPC.

isDefault boolean

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

regionId string

ID of the region where the VPC is located.

resourceGroupId string

The Id of resource group which VPC belongs.

routeTableId string

Route table ID of the VRouter.

routerId string

The ID of the VRouter.

secondaryCidrBlocks string[]

A list of secondary IPv4 CIDR blocks of the VPC.

status string

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

tags {[key: string]: any}

A mapping of tags to assign to the resource.

userCidrs string[]

A list of user CIDRs.

vpcId string

ID of the VPC.

vpcName string

The name of the VPC.

vrouterId string

ID of the VRouter.

vswitchIds string[]

List of VSwitch IDs in the specified VPC

cidr_block str

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

creation_time str

Time of creation.

description str

Description of the VPC

id str

ID of the VPC.

ipv6_cidr_block str

The IPv6 CIDR block of the VPC.

is_default bool

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

region_id str

ID of the region where the VPC is located.

resource_group_id str

The Id of resource group which VPC belongs.

route_table_id str

Route table ID of the VRouter.

router_id str

The ID of the VRouter.

secondary_cidr_blocks Sequence[str]

A list of secondary IPv4 CIDR blocks of the VPC.

status str

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

tags Mapping[str, Any]

A mapping of tags to assign to the resource.

user_cidrs Sequence[str]

A list of user CIDRs.

vpc_id str

ID of the VPC.

vpc_name str

The name of the VPC.

vrouter_id str

ID of the VRouter.

vswitch_ids Sequence[str]

List of VSwitch IDs in the specified VPC

cidrBlock String

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

creationTime String

Time of creation.

description String

Description of the VPC

id String

ID of the VPC.

ipv6CidrBlock String

The IPv6 CIDR block of the VPC.

isDefault Boolean

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

regionId String

ID of the region where the VPC is located.

resourceGroupId String

The Id of resource group which VPC belongs.

routeTableId String

Route table ID of the VRouter.

routerId String

The ID of the VRouter.

secondaryCidrBlocks List<String>

A list of secondary IPv4 CIDR blocks of the VPC.

status String

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

tags Map<Any>

A mapping of tags to assign to the resource.

userCidrs List<String>

A list of user CIDRs.

vpcId String

ID of the VPC.

vpcName String

The name of the VPC.

vrouterId String

ID of the VRouter.

vswitchIds List<String>

List of VSwitch IDs in the specified VPC

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.