getRouteTables

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(_foo -> _foo.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

argument

A collection of arguments for invoking getRouteTables.


suspend fun getRouteTables(ids: List<String>? = null, nameRegex: String? = null, outputFile: String? = null, pageNumber: Int? = null, pageSize: Int? = null, resourceGroupId: String? = null, routeTableName: String? = null, routeTableType: String? = null, routerId: String? = null, routerType: String? = null, status: String? = null, tags: Map<String, String>? = null, vpcId: String? = null): GetRouteTablesResult

Return

A collection of values returned by getRouteTables.

Parameters

ids

A list of Route Tables IDs.

nameRegex

A regex string to filter route tables by name.

outputFile

File name where to save data source results (after running pulumi preview).

pageNumber
pageSize
resourceGroupId

The Id of resource group which route tables belongs.

routeTableName

The route table name.

routeTableType

The route table type.

routerId

The router ID.

routerType

The route type of route table. Valid values: VRouter and VBR.

status

The status of resource. Valid values: Available and Pending.

tags

A mapping of tags to assign to the resource.

vpcId

Vpc id of the route table.

See also


Return

A collection of values returned by getRouteTables.

Parameters

argument

Builder for com.pulumi.alicloud.vpc.kotlin.inputs.GetRouteTablesPlainArgs.

See also