1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. vpc
  5. getNetworks
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.vpc.getNetworks

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    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:

    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
    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
    File name where to save data source results (after running pulumi preview).
    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, string>
    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
    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
    File name where to save data source results (after running pulumi preview).
    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]string
    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
    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
    File name where to save data source results (after running pulumi preview).
    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,String>
    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
    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
    File name where to save data source results (after running pulumi preview).
    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]: string}
    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
    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
    File name where to save data source results (after running pulumi preview).
    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, str]
    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
    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
    File name where to save data source results (after running pulumi preview).
    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<String>
    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, string>
    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]string
    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,String>
    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]: string}
    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, str]
    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<String>
    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, string>
    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]string
    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,String>
    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]: string}
    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, 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
    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>
    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
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi