Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi
alicloud.vpc.getRouteTables
Explore with Pulumi AI
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)
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
})
}
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 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}
Using getRouteTables
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 getRouteTables(args: GetRouteTablesArgs, opts?: InvokeOptions): Promise<GetRouteTablesResult>
function getRouteTablesOutput(args: GetRouteTablesOutputArgs, opts?: InvokeOptions): Output<GetRouteTablesResult>
def get_route_tables(ids: Optional[Sequence[str]] = 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,
route_table_name: Optional[str] = None,
route_table_type: Optional[str] = None,
router_id: Optional[str] = None,
router_type: Optional[str] = None,
status: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
vpc_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetRouteTablesResult
def get_route_tables_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = 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,
route_table_name: Optional[pulumi.Input[str]] = None,
route_table_type: Optional[pulumi.Input[str]] = None,
router_id: Optional[pulumi.Input[str]] = None,
router_type: Optional[pulumi.Input[str]] = None,
status: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
vpc_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetRouteTablesResult]
func GetRouteTables(ctx *Context, args *GetRouteTablesArgs, opts ...InvokeOption) (*GetRouteTablesResult, error)
func GetRouteTablesOutput(ctx *Context, args *GetRouteTablesOutputArgs, opts ...InvokeOption) GetRouteTablesResultOutput
> Note: This function is named GetRouteTables
in the Go SDK.
public static class GetRouteTables
{
public static Task<GetRouteTablesResult> InvokeAsync(GetRouteTablesArgs args, InvokeOptions? opts = null)
public static Output<GetRouteTablesResult> Invoke(GetRouteTablesInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetRouteTablesResult> getRouteTables(GetRouteTablesArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: alicloud:vpc/getRouteTables:getRouteTables
arguments:
# arguments dictionary
The following arguments are supported:
- Ids List<string>
- A list of Route Tables IDs.
- Name
Regex string - A regex string to filter route tables 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 route tables belongs.
- Route
Table stringName - The route table name.
- Route
Table stringType - The route table type.
- Router
Id string - The router ID.
- Router
Type string - The route type of route table. Valid values:
VRouter
andVBR
. - Status string
- The status of resource. Valid values:
Available
andPending
. - Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Vpc
Id string - Vpc id of the route table.
- Ids []string
- A list of Route Tables IDs.
- Name
Regex string - A regex string to filter route tables 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 route tables belongs.
- Route
Table stringName - The route table name.
- Route
Table stringType - The route table type.
- Router
Id string - The router ID.
- Router
Type string - The route type of route table. Valid values:
VRouter
andVBR
. - Status string
- The status of resource. Valid values:
Available
andPending
. - map[string]string
- A mapping of tags to assign to the resource.
- Vpc
Id string - Vpc id of the route table.
- ids List<String>
- A list of Route Tables IDs.
- name
Regex String - A regex string to filter route tables 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 route tables belongs.
- route
Table StringName - The route table name.
- route
Table StringType - The route table type.
- router
Id String - The router ID.
- router
Type String - The route type of route table. Valid values:
VRouter
andVBR
. - status String
- The status of resource. Valid values:
Available
andPending
. - Map<String,String>
- A mapping of tags to assign to the resource.
- vpc
Id String - Vpc id of the route table.
- ids string[]
- A list of Route Tables IDs.
- name
Regex string - A regex string to filter route tables 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 route tables belongs.
- route
Table stringName - The route table name.
- route
Table stringType - The route table type.
- router
Id string - The router ID.
- router
Type string - The route type of route table. Valid values:
VRouter
andVBR
. - status string
- The status of resource. Valid values:
Available
andPending
. - {[key: string]: string}
- A mapping of tags to assign to the resource.
- vpc
Id string - Vpc id of the route table.
- ids Sequence[str]
- A list of Route Tables IDs.
- name_
regex str - A regex string to filter route tables 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 route tables belongs.
- route_
table_ strname - The route table name.
- route_
table_ strtype - The route table type.
- router_
id str - The router ID.
- router_
type str - The route type of route table. Valid values:
VRouter
andVBR
. - status str
- The status of resource. Valid values:
Available
andPending
. - Mapping[str, str]
- A mapping of tags to assign to the resource.
- vpc_
id str - Vpc id of the route table.
- ids List<String>
- A list of Route Tables IDs.
- name
Regex String - A regex string to filter route tables 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 route tables belongs.
- route
Table StringName - The route table name.
- route
Table StringType - The route table type.
- router
Id String - The router ID.
- router
Type String - The route type of route table. Valid values:
VRouter
andVBR
. - status String
- The status of resource. Valid values:
Available
andPending
. - Map<String>
- A mapping of tags to assign to the resource.
- vpc
Id String - Vpc id of the route table.
getRouteTables Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- (Optional) A list of Route Tables IDs.
- Names List<string>
- A list of Route Tables names.
- Tables
List<Pulumi.
Ali Cloud. Vpc. Outputs. Get Route Tables Table> - A list of Route Tables. Each element contains the following attributes:
- Total
Count int - Name
Regex string - Output
File string - Page
Number int - Page
Size int - Resource
Group stringId - The Id of resource group which route tables belongs.
- Route
Table stringName - The route table name.
- Route
Table stringType - The type of route table.
- Router
Id string - Router Id of the route table.
- Router
Type string - The route type.
- Status string
- The status of route table.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Vpc
Id string - The VPC ID.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- (Optional) A list of Route Tables IDs.
- Names []string
- A list of Route Tables names.
- Tables
[]Get
Route Tables Table - A list of Route Tables. Each element contains the following attributes:
- Total
Count int - Name
Regex string - Output
File string - Page
Number int - Page
Size int - Resource
Group stringId - The Id of resource group which route tables belongs.
- Route
Table stringName - The route table name.
- Route
Table stringType - The type of route table.
- Router
Id string - Router Id of the route table.
- Router
Type string - The route type.
- Status string
- The status of route table.
- map[string]string
- A mapping of tags to assign to the resource.
- Vpc
Id string - The VPC ID.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- (Optional) A list of Route Tables IDs.
- names List<String>
- A list of Route Tables names.
- tables
List<Get
Route Tables Table> - A list of Route Tables. Each element contains the following attributes:
- total
Count Integer - name
Regex String - output
File String - page
Number Integer - page
Size Integer - resource
Group StringId - The Id of resource group which route tables belongs.
- route
Table StringName - The route table name.
- route
Table StringType - The type of route table.
- router
Id String - Router Id of the route table.
- router
Type String - The route type.
- status String
- The status of route table.
- Map<String,String>
- A mapping of tags to assign to the resource.
- vpc
Id String - The VPC ID.
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- (Optional) A list of Route Tables IDs.
- names string[]
- A list of Route Tables names.
- tables
Get
Route Tables Table[] - A list of Route Tables. Each element contains the following attributes:
- total
Count number - name
Regex string - output
File string - page
Number number - page
Size number - resource
Group stringId - The Id of resource group which route tables belongs.
- route
Table stringName - The route table name.
- route
Table stringType - The type of route table.
- router
Id string - Router Id of the route table.
- router
Type string - The route type.
- status string
- The status of route table.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- vpc
Id string - The VPC ID.
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- (Optional) A list of Route Tables IDs.
- names Sequence[str]
- A list of Route Tables names.
- tables
Sequence[Get
Route Tables Table] - A list of Route Tables. Each element contains the following attributes:
- total_
count int - name_
regex str - output_
file str - page_
number int - page_
size int - resource_
group_ strid - The Id of resource group which route tables belongs.
- route_
table_ strname - The route table name.
- route_
table_ strtype - The type of route table.
- router_
id str - Router Id of the route table.
- router_
type str - The route type.
- status str
- The status of route table.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- vpc_
id str - The VPC ID.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- (Optional) A list of Route Tables IDs.
- names List<String>
- A list of Route Tables names.
- tables List<Property Map>
- A list of Route Tables. Each element contains the following attributes:
- total
Count Number - name
Regex String - output
File String - page
Number Number - page
Size Number - resource
Group StringId - The Id of resource group which route tables belongs.
- route
Table StringName - The route table name.
- route
Table StringType - The type of route table.
- router
Id String - Router Id of the route table.
- router
Type String - The route type.
- status String
- The status of route table.
- Map<String>
- A mapping of tags to assign to the resource.
- vpc
Id String - The VPC ID.
Supporting Types
GetRouteTablesTable
- Description string
- The description of the route table instance.
- Id string
- ID of the Route Table.
- Name string
- Name of the route table.
- Resource
Group stringId - The Id of resource group which route tables belongs.
- Route
Table stringId - The route table id.
- Route
Table stringName - The route table name.
- Route
Table stringType - The route table type.
- Router
Id string - The router ID.
- Router
Type string - The route type of route table. Valid values:
VRouter
andVBR
. - Status string
- The status of resource. Valid values:
Available
andPending
. - Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Vpc
Id string - Vpc id of the route table.
- Vswitch
Ids List<string> - A list of vswitch id.
- Description string
- The description of the route table instance.
- Id string
- ID of the Route Table.
- Name string
- Name of the route table.
- Resource
Group stringId - The Id of resource group which route tables belongs.
- Route
Table stringId - The route table id.
- Route
Table stringName - The route table name.
- Route
Table stringType - The route table type.
- Router
Id string - The router ID.
- Router
Type string - The route type of route table. Valid values:
VRouter
andVBR
. - Status string
- The status of resource. Valid values:
Available
andPending
. - map[string]string
- A mapping of tags to assign to the resource.
- Vpc
Id string - Vpc id of the route table.
- Vswitch
Ids []string - A list of vswitch id.
- description String
- The description of the route table instance.
- id String
- ID of the Route Table.
- name String
- Name of the route table.
- resource
Group StringId - The Id of resource group which route tables belongs.
- route
Table StringId - The route table id.
- route
Table StringName - The route table name.
- route
Table StringType - The route table type.
- router
Id String - The router ID.
- router
Type String - The route type of route table. Valid values:
VRouter
andVBR
. - status String
- The status of resource. Valid values:
Available
andPending
. - Map<String,String>
- A mapping of tags to assign to the resource.
- vpc
Id String - Vpc id of the route table.
- vswitch
Ids List<String> - A list of vswitch id.
- description string
- The description of the route table instance.
- id string
- ID of the Route Table.
- name string
- Name of the route table.
- resource
Group stringId - The Id of resource group which route tables belongs.
- route
Table stringId - The route table id.
- route
Table stringName - The route table name.
- route
Table stringType - The route table type.
- router
Id string - The router ID.
- router
Type string - The route type of route table. Valid values:
VRouter
andVBR
. - status string
- The status of resource. Valid values:
Available
andPending
. - {[key: string]: string}
- A mapping of tags to assign to the resource.
- vpc
Id string - Vpc id of the route table.
- vswitch
Ids string[] - A list of vswitch id.
- description str
- The description of the route table instance.
- id str
- ID of the Route Table.
- name str
- Name of the route table.
- resource_
group_ strid - The Id of resource group which route tables belongs.
- route_
table_ strid - The route table id.
- route_
table_ strname - The route table name.
- route_
table_ strtype - The route table type.
- router_
id str - The router ID.
- router_
type str - The route type of route table. Valid values:
VRouter
andVBR
. - status str
- The status of resource. Valid values:
Available
andPending
. - Mapping[str, str]
- A mapping of tags to assign to the resource.
- vpc_
id str - Vpc id of the route table.
- vswitch_
ids Sequence[str] - A list of vswitch id.
- description String
- The description of the route table instance.
- id String
- ID of the Route Table.
- name String
- Name of the route table.
- resource
Group StringId - The Id of resource group which route tables belongs.
- route
Table StringId - The route table id.
- route
Table StringName - The route table name.
- route
Table StringType - The route table type.
- router
Id String - The router ID.
- router
Type String - The route type of route table. Valid values:
VRouter
andVBR
. - status String
- The status of resource. Valid values:
Available
andPending
. - Map<String>
- A mapping of tags to assign to the resource.
- vpc
Id String - Vpc id of the route table.
- vswitch
Ids List<String> - A list of vswitch id.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.