get Networks
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.Apply(getNetworksResult => getNetworksResult.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.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
A collection of arguments for invoking getNetworks.
Return
A collection of values returned by getNetworks.
Parameters
Filter results by a specific CIDR block. For example: "172.16.0.0/12".
The ID of dhcp options set.
Indicates whether to check this request only. Valid values: true
and false
.
Default to true
. Set it to true can output the route_table_id
.
A list of VPC IDs.
Indicate whether the VPC is the default one in the specified region.
A regex string to filter VPCs by name.
File name where to save data source results (after running pulumi preview
).
The Id of resource group which VPC belongs.
Filter results by a specific status. Valid value are Pending
and Available
.
A mapping of tags to assign to the resource.
The name of the VPC.
The owner ID of VPC.
Filter results by the specified vSwitch.
See also
Return
A collection of values returned by getNetworks.
Parameters
Builder for com.pulumi.alicloud.vpc.kotlin.inputs.GetNetworksPlainArgs.