get Route Tables
This data source provides a list of Route Tables owned by an Alibaba Cloud account.
NOTE: Available since v1.36.0.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "route-tables-datasource-example-name";
const fooNetwork = new alicloud.vpc.Network("foo", {
cidrBlock: "172.16.0.0/12",
vpcName: name,
});
const fooRouteTable = new alicloud.vpc.RouteTable("foo", {
vpcId: fooNetwork.id,
routeTableName: name,
description: name,
});
const foo = alicloud.vpc.getRouteTablesOutput({
ids: [fooRouteTable.id],
routeTableType: "Custom",
});
export const routeTableIds = foo.apply(foo => foo.ids);
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "route-tables-datasource-example-name"
foo_network = alicloud.vpc.Network("foo",
cidr_block="172.16.0.0/12",
vpc_name=name)
foo_route_table = alicloud.vpc.RouteTable("foo",
vpc_id=foo_network.id,
route_table_name=name,
description=name)
foo = alicloud.vpc.get_route_tables_output(ids=[foo_route_table.id],
route_table_type="Custom")
pulumi.export("routeTableIds", foo.ids)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "route-tables-datasource-example-name";
var fooNetwork = new AliCloud.Vpc.Network("foo", new()
{
CidrBlock = "172.16.0.0/12",
VpcName = name,
});
var fooRouteTable = new AliCloud.Vpc.RouteTable("foo", new()
{
VpcId = fooNetwork.Id,
RouteTableName = name,
Description = name,
});
var foo = AliCloud.Vpc.GetRouteTables.Invoke(new()
{
Ids = new[]
{
fooRouteTable.Id,
},
RouteTableType = "Custom",
});
return new Dictionary<string, object?>
{
["routeTableIds"] = foo.Apply(getRouteTablesResult => getRouteTablesResult.Ids),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "route-tables-datasource-example-name";
if param := cfg.Get("name"); param != ""{
name = param
}
fooNetwork, err := vpc.NewNetwork(ctx, "foo", &vpc.NetworkArgs{
CidrBlock: pulumi.String("172.16.0.0/12"),
VpcName: pulumi.String(name),
})
if err != nil {
return err
}
fooRouteTable, err := vpc.NewRouteTable(ctx, "foo", &vpc.RouteTableArgs{
VpcId: fooNetwork.ID(),
RouteTableName: pulumi.String(name),
Description: pulumi.String(name),
})
if err != nil {
return err
}
foo := vpc.GetRouteTablesOutput(ctx, vpc.GetRouteTablesOutputArgs{
Ids: pulumi.StringArray{
fooRouteTable.ID(),
},
RouteTableType: pulumi.String("Custom"),
}, nil);
ctx.Export("routeTableIds", foo.ApplyT(func(foo vpc.GetRouteTablesResult) (interface{}, error) {
return foo.Ids, nil
}).(pulumi.Interface{}Output))
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.RouteTable;
import com.pulumi.alicloud.vpc.RouteTableArgs;
import com.pulumi.alicloud.vpc.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetRouteTablesArgs;
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 config = ctx.config();
final var name = config.get("name").orElse("route-tables-datasource-example-name");
var fooNetwork = new Network("fooNetwork", NetworkArgs.builder()
.cidrBlock("172.16.0.0/12")
.vpcName(name)
.build());
var fooRouteTable = new RouteTable("fooRouteTable", RouteTableArgs.builder()
.vpcId(fooNetwork.id())
.routeTableName(name)
.description(name)
.build());
final var foo = VpcFunctions.getRouteTables(GetRouteTablesArgs.builder()
.ids(fooRouteTable.id())
.routeTableType("Custom")
.build());
ctx.export("routeTableIds", foo.applyValue(getRouteTablesResult -> getRouteTablesResult).applyValue(foo -> foo.applyValue(getRouteTablesResult -> getRouteTablesResult.ids())));
}
}
configuration:
name:
type: string
default: route-tables-datasource-example-name
resources:
fooNetwork:
type: alicloud:vpc:Network
name: foo
properties:
cidrBlock: 172.16.0.0/12
vpcName: ${name}
fooRouteTable:
type: alicloud:vpc:RouteTable
name: foo
properties:
vpcId: ${fooNetwork.id}
routeTableName: ${name}
description: ${name}
variables:
foo:
fn::invoke:
function: alicloud:vpc:getRouteTables
arguments:
ids:
- ${fooRouteTable.id}
routeTableType: Custom
outputs:
routeTableIds: ${foo.ids}
Return
A collection of values returned by getRouteTables.
Parameters
A collection of arguments for invoking getRouteTables.
Return
A collection of values returned by getRouteTables.
Parameters
A list of Route Tables IDs.
A regex string to filter route tables by name.
File name where to save data source results (after running pulumi preview
).
The Id of resource group which route tables belongs.
The route table name.
The route table type.
The router ID.
The route type of route table. Valid values: VRouter
and VBR
.
The status of resource. Valid values: Available
and Pending
.
A mapping of tags to assign to the resource.
Vpc id of the route table.
See also
Return
A collection of values returned by getRouteTables.
Parameters
Builder for com.pulumi.alicloud.vpc.kotlin.inputs.GetRouteTablesPlainArgs.