Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi
alicloud.vpc.getNetworks
Explore with Pulumi AI
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)
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
})
}
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.Apply(getNetworksResult => getNetworksResult.Vpcs[0]?.Id),
};
});
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}
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, str]] = 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, pulumi.Input[str]]]] = 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:
- Cidr
Block string - Filter results by a specific CIDR block. For example: "172.16.0.0/12".
- Dhcp
Options stringSet Id - The ID of dhcp options set.
- Dry
Run bool - Indicates whether to check this request only. Valid values:
true
andfalse
. - Enable
Details bool - Default to
true
. Set it to true can output theroute_table_id
. - Ids List<string>
- A list of VPC IDs.
- Is
Default bool - Indicate whether the VPC is the default one in the specified region.
- Name
Regex string - A regex string to filter VPCs by name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Page
Number int - Page
Size int - Resource
Group stringId - The Id of resource group which VPC belongs.
- Status string
- Filter results by a specific status. Valid value are
Pending
andAvailable
. - Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Vpc
Name string - The name of the VPC.
- Vpc
Owner intId - The owner ID of VPC.
- Vswitch
Id string - Filter results by the specified vSwitch.
- Cidr
Block string - Filter results by a specific CIDR block. For example: "172.16.0.0/12".
- Dhcp
Options stringSet Id - The ID of dhcp options set.
- Dry
Run bool - Indicates whether to check this request only. Valid values:
true
andfalse
. - Enable
Details bool - Default to
true
. Set it to true can output theroute_table_id
. - Ids []string
- A list of VPC IDs.
- Is
Default bool - Indicate whether the VPC is the default one in the specified region.
- Name
Regex string - A regex string to filter VPCs by name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Page
Number int - Page
Size int - Resource
Group stringId - The Id of resource group which VPC belongs.
- Status string
- Filter results by a specific status. Valid value are
Pending
andAvailable
. - map[string]string
- A mapping of tags to assign to the resource.
- Vpc
Name string - The name of the VPC.
- Vpc
Owner intId - The owner ID of VPC.
- Vswitch
Id string - Filter results by the specified vSwitch.
- cidr
Block String - Filter results by a specific CIDR block. For example: "172.16.0.0/12".
- dhcp
Options StringSet Id - The ID of dhcp options set.
- dry
Run Boolean - Indicates whether to check this request only. Valid values:
true
andfalse
. - enable
Details Boolean - Default to
true
. Set it to true can output theroute_table_id
. - ids List<String>
- A list of VPC IDs.
- is
Default Boolean - Indicate whether the VPC is the default one in the specified region.
- name
Regex String - A regex string to filter VPCs by name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - page
Number Integer - page
Size Integer - resource
Group StringId - The Id of resource group which VPC belongs.
- status String
- Filter results by a specific status. Valid value are
Pending
andAvailable
. - Map<String,String>
- A mapping of tags to assign to the resource.
- vpc
Name String - The name of the VPC.
- vpc
Owner IntegerId - The owner ID of VPC.
- vswitch
Id String - Filter results by the specified vSwitch.
- cidr
Block string - Filter results by a specific CIDR block. For example: "172.16.0.0/12".
- dhcp
Options stringSet Id - The ID of dhcp options set.
- dry
Run boolean - Indicates whether to check this request only. Valid values:
true
andfalse
. - enable
Details boolean - Default to
true
. Set it to true can output theroute_table_id
. - ids string[]
- A list of VPC IDs.
- is
Default boolean - Indicate whether the VPC is the default one in the specified region.
- name
Regex string - A regex string to filter VPCs by name.
- output
File string - File name where to save data source results (after running
pulumi preview
). - page
Number number - page
Size number - resource
Group stringId - The Id of resource group which VPC belongs.
- status string
- Filter results by a specific status. Valid value are
Pending
andAvailable
. - {[key: string]: string}
- A mapping of tags to assign to the resource.
- vpc
Name string - The name of the VPC.
- vpc
Owner numberId - The owner ID of VPC.
- vswitch
Id 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_ strset_ id - The ID of dhcp options set.
- dry_
run bool - Indicates whether to check this request only. Valid values:
true
andfalse
. - enable_
details bool - Default to
true
. Set it to true can output theroute_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 - File name where to save data source results (after running
pulumi preview
). - page_
number int - page_
size int - resource_
group_ strid - The Id of resource group which VPC belongs.
- status str
- Filter results by a specific status. Valid value are
Pending
andAvailable
. - Mapping[str, str]
- A mapping of tags to assign to the resource.
- vpc_
name str - The name of the VPC.
- vpc_
owner_ intid - The owner ID of VPC.
- vswitch_
id str - Filter results by the specified vSwitch.
- cidr
Block String - Filter results by a specific CIDR block. For example: "172.16.0.0/12".
- dhcp
Options StringSet Id - The ID of dhcp options set.
- dry
Run Boolean - Indicates whether to check this request only. Valid values:
true
andfalse
. - enable
Details Boolean - Default to
true
. Set it to true can output theroute_table_id
. - ids List<String>
- A list of VPC IDs.
- is
Default Boolean - Indicate whether the VPC is the default one in the specified region.
- name
Regex String - A regex string to filter VPCs by name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - page
Number Number - page
Size Number - resource
Group StringId - The Id of resource group which VPC belongs.
- status String
- Filter results by a specific status. Valid value are
Pending
andAvailable
. - Map<String>
- A mapping of tags to assign to the resource.
- vpc
Name String - The name of the VPC.
- vpc
Owner NumberId - The owner ID of VPC.
- vswitch
Id 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.
- Total
Count int - Vpcs
List<Pulumi.
Ali Cloud. Vpc. Outputs. Get Networks Vpc> - A list of VPCs. Each element contains the following attributes:
- Cidr
Block string - CIDR block of the VPC.
- Dhcp
Options stringSet Id - Dry
Run bool - Enable
Details bool - Is
Default bool - Whether the VPC is the default VPC in the region.
- Name
Regex string - Output
File string - Page
Number int - Page
Size int - Resource
Group stringId - Status string
- Status of the VPC.
- Dictionary<string, string>
- A map of tags assigned to the VPC.
- Vpc
Name string - Name of the VPC.
- Vpc
Owner intId - Vswitch
Id 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.
- Total
Count int - Vpcs
[]Get
Networks Vpc - A list of VPCs. Each element contains the following attributes:
- Cidr
Block string - CIDR block of the VPC.
- Dhcp
Options stringSet Id - Dry
Run bool - Enable
Details bool - Is
Default bool - Whether the VPC is the default VPC in the region.
- Name
Regex string - Output
File string - Page
Number int - Page
Size int - Resource
Group stringId - Status string
- Status of the VPC.
- map[string]string
- A map of tags assigned to the VPC.
- Vpc
Name string - Name of the VPC.
- Vpc
Owner intId - Vswitch
Id 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.
- total
Count Integer - vpcs
List<Get
Networks Vpc> - A list of VPCs. Each element contains the following attributes:
- cidr
Block String - CIDR block of the VPC.
- dhcp
Options StringSet Id - dry
Run Boolean - enable
Details Boolean - is
Default Boolean - Whether the VPC is the default VPC in the region.
- name
Regex String - output
File String - page
Number Integer - page
Size Integer - resource
Group StringId - status String
- Status of the VPC.
- Map<String,String>
- A map of tags assigned to the VPC.
- vpc
Name String - Name of the VPC.
- vpc
Owner IntegerId - vswitch
Id 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.
- total
Count number - vpcs
Get
Networks Vpc[] - A list of VPCs. Each element contains the following attributes:
- cidr
Block string - CIDR block of the VPC.
- dhcp
Options stringSet Id - dry
Run boolean - enable
Details boolean - is
Default boolean - Whether the VPC is the default VPC in the region.
- name
Regex string - output
File string - page
Number number - page
Size number - resource
Group stringId - status string
- Status of the VPC.
- {[key: string]: string}
- A map of tags assigned to the VPC.
- vpc
Name string - Name of the VPC.
- vpc
Owner numberId - vswitch
Id 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[Get
Networks Vpc] - A list of VPCs. Each element contains the following attributes:
- cidr_
block str - CIDR block of the VPC.
- dhcp_
options_ strset_ id - 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_ strid - status str
- Status of the VPC.
- Mapping[str, str]
- A map of tags assigned to the VPC.
- vpc_
name str - Name of the VPC.
- vpc_
owner_ intid - 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.
- total
Count Number - vpcs List<Property Map>
- A list of VPCs. Each element contains the following attributes:
- cidr
Block String - CIDR block of the VPC.
- dhcp
Options StringSet Id - dry
Run Boolean - enable
Details Boolean - is
Default Boolean - Whether the VPC is the default VPC in the region.
- name
Regex String - output
File String - page
Number Number - page
Size Number - resource
Group StringId - status String
- Status of the VPC.
- Map<String>
- A map of tags assigned to the VPC.
- vpc
Name String - Name of the VPC.
- vpc
Owner NumberId - vswitch
Id String
Supporting Types
GetNetworksVpc
- Cidr
Block string - Filter results by a specific CIDR block. For example: "172.16.0.0/12".
- Creation
Time string - Time of creation.
- Description string
- Description of the VPC
- Id string
- ID of the VPC.
- Ipv6Cidr
Block string - The IPv6 CIDR block of the VPC.
- Is
Default bool - Indicate whether the VPC is the default one in the specified region.
- Region
Id string - ID of the region where the VPC is located.
- Resource
Group stringId - The Id of resource group which VPC belongs.
- Route
Table stringId - Route table ID of the VRouter.
- Router
Id string - The ID of the VRouter.
- Secondary
Cidr List<string>Blocks - A list of secondary IPv4 CIDR blocks of the VPC.
- Status string
- Filter results by a specific status. Valid value are
Pending
andAvailable
. - Dictionary<string, string>
- A mapping of tags to assign to the resource.
- User
Cidrs List<string> - A list of user CIDRs.
- Vpc
Id string - ID of the VPC.
- Vpc
Name string - The name of the VPC.
- Vrouter
Id string - ID of the VRouter.
- Vswitch
Ids List<string> - List of vSwitch IDs in the specified VPC
- Cidr
Block string - Filter results by a specific CIDR block. For example: "172.16.0.0/12".
- Creation
Time string - Time of creation.
- Description string
- Description of the VPC
- Id string
- ID of the VPC.
- Ipv6Cidr
Block string - The IPv6 CIDR block of the VPC.
- Is
Default bool - Indicate whether the VPC is the default one in the specified region.
- Region
Id string - ID of the region where the VPC is located.
- Resource
Group stringId - The Id of resource group which VPC belongs.
- Route
Table stringId - Route table ID of the VRouter.
- Router
Id string - The ID of the VRouter.
- Secondary
Cidr []stringBlocks - A list of secondary IPv4 CIDR blocks of the VPC.
- Status string
- Filter results by a specific status. Valid value are
Pending
andAvailable
. - map[string]string
- A mapping of tags to assign to the resource.
- User
Cidrs []string - A list of user CIDRs.
- Vpc
Id string - ID of the VPC.
- Vpc
Name string - The name of the VPC.
- Vrouter
Id string - ID of the VRouter.
- Vswitch
Ids []string - List of vSwitch IDs in the specified VPC
- cidr
Block String - Filter results by a specific CIDR block. For example: "172.16.0.0/12".
- creation
Time String - Time of creation.
- description String
- Description of the VPC
- id String
- ID of the VPC.
- ipv6Cidr
Block String - The IPv6 CIDR block of the VPC.
- is
Default Boolean - Indicate whether the VPC is the default one in the specified region.
- region
Id String - ID of the region where the VPC is located.
- resource
Group StringId - The Id of resource group which VPC belongs.
- route
Table StringId - Route table ID of the VRouter.
- router
Id String - The ID of the VRouter.
- secondary
Cidr List<String>Blocks - A list of secondary IPv4 CIDR blocks of the VPC.
- status String
- Filter results by a specific status. Valid value are
Pending
andAvailable
. - Map<String,String>
- A mapping of tags to assign to the resource.
- user
Cidrs List<String> - A list of user CIDRs.
- vpc
Id String - ID of the VPC.
- vpc
Name String - The name of the VPC.
- vrouter
Id String - ID of the VRouter.
- vswitch
Ids List<String> - List of vSwitch IDs in the specified VPC
- cidr
Block string - Filter results by a specific CIDR block. For example: "172.16.0.0/12".
- creation
Time string - Time of creation.
- description string
- Description of the VPC
- id string
- ID of the VPC.
- ipv6Cidr
Block string - The IPv6 CIDR block of the VPC.
- is
Default boolean - Indicate whether the VPC is the default one in the specified region.
- region
Id string - ID of the region where the VPC is located.
- resource
Group stringId - The Id of resource group which VPC belongs.
- route
Table stringId - Route table ID of the VRouter.
- router
Id string - The ID of the VRouter.
- secondary
Cidr string[]Blocks - A list of secondary IPv4 CIDR blocks of the VPC.
- status string
- Filter results by a specific status. Valid value are
Pending
andAvailable
. - {[key: string]: string}
- A mapping of tags to assign to the resource.
- user
Cidrs string[] - A list of user CIDRs.
- vpc
Id string - ID of the VPC.
- vpc
Name string - The name of the VPC.
- vrouter
Id string - ID of the VRouter.
- vswitch
Ids 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_ strblock - 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_ strid - The Id of resource group which VPC belongs.
- route_
table_ strid - Route table ID of the VRouter.
- router_
id str - The ID of the VRouter.
- secondary_
cidr_ Sequence[str]blocks - A list of secondary IPv4 CIDR blocks of the VPC.
- status str
- Filter results by a specific status. Valid value are
Pending
andAvailable
. - Mapping[str, str]
- 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
- cidr
Block String - Filter results by a specific CIDR block. For example: "172.16.0.0/12".
- creation
Time String - Time of creation.
- description String
- Description of the VPC
- id String
- ID of the VPC.
- ipv6Cidr
Block String - The IPv6 CIDR block of the VPC.
- is
Default Boolean - Indicate whether the VPC is the default one in the specified region.
- region
Id String - ID of the region where the VPC is located.
- resource
Group StringId - The Id of resource group which VPC belongs.
- route
Table StringId - Route table ID of the VRouter.
- router
Id String - The ID of the VRouter.
- secondary
Cidr List<String>Blocks - A list of secondary IPv4 CIDR blocks of the VPC.
- status String
- Filter results by a specific status. Valid value are
Pending
andAvailable
. - Map<String>
- A mapping of tags to assign to the resource.
- user
Cidrs List<String> - A list of user CIDRs.
- vpc
Id String - ID of the VPC.
- vpc
Name String - The name of the VPC.
- vrouter
Id String - ID of the VRouter.
- vswitch
Ids List<String> - List of vSwitch IDs in the specified VPC
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.