1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. vpc
  5. getRouteTables
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.vpc.getRouteTables

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    This data source provides a list of Route Tables owned by an Alibaba Cloud account.

    NOTE: Available in 1.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],
    });
    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])
    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(),
    },
    }, 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,
            },
        });
    
        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())
                .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}
    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,
                         router_id: Optional[str] = None,
                         router_type: Optional[str] = None,
                         status: Optional[str] = None,
                         tags: Optional[Mapping[str, Any]] = 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,
                         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, Any]]] = 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.
    NameRegex string
    A regex string to filter route tables 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 route tables belongs.
    RouteTableName string
    The route table name.
    RouterId string
    The router ID.
    RouterType string
    The route type of route table. Valid values: VRouter and VBR.
    Status string
    The status of resource. Valid values: Available and Pending.
    Tags Dictionary<string, object>
    A mapping of tags to assign to the resource.
    VpcId string
    Vpc id of the route table.
    Ids []string
    A list of Route Tables IDs.
    NameRegex string
    A regex string to filter route tables 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 route tables belongs.
    RouteTableName string
    The route table name.
    RouterId string
    The router ID.
    RouterType string
    The route type of route table. Valid values: VRouter and VBR.
    Status string
    The status of resource. Valid values: Available and Pending.
    Tags map[string]interface{}
    A mapping of tags to assign to the resource.
    VpcId string
    Vpc id of the route table.
    ids List<String>
    A list of Route Tables IDs.
    nameRegex String
    A regex string to filter route tables 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 route tables belongs.
    routeTableName String
    The route table name.
    routerId String
    The router ID.
    routerType String
    The route type of route table. Valid values: VRouter and VBR.
    status String
    The status of resource. Valid values: Available and Pending.
    tags Map<String,Object>
    A mapping of tags to assign to the resource.
    vpcId String
    Vpc id of the route table.
    ids string[]
    A list of Route Tables IDs.
    nameRegex string
    A regex string to filter route tables 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 route tables belongs.
    routeTableName string
    The route table name.
    routerId string
    The router ID.
    routerType string
    The route type of route table. Valid values: VRouter and VBR.
    status string
    The status of resource. Valid values: Available and Pending.
    tags {[key: string]: any}
    A mapping of tags to assign to the resource.
    vpcId 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_id str
    The Id of resource group which route tables belongs.
    route_table_name str
    The route table name.
    router_id str
    The router ID.
    router_type str
    The route type of route table. Valid values: VRouter and VBR.
    status str
    The status of resource. Valid values: Available and Pending.
    tags Mapping[str, Any]
    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.
    nameRegex String
    A regex string to filter route tables 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 route tables belongs.
    routeTableName String
    The route table name.
    routerId String
    The router ID.
    routerType String
    The route type of route table. Valid values: VRouter and VBR.
    status String
    The status of resource. Valid values: Available and Pending.
    tags Map<Any>
    A mapping of tags to assign to the resource.
    vpcId 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.AliCloud.Vpc.Outputs.GetRouteTablesTable>
    A list of Route Tables. Each element contains the following attributes:
    TotalCount int
    NameRegex string
    OutputFile string
    PageNumber int
    PageSize int
    ResourceGroupId string
    The Id of resource group which route tables belongs.
    RouteTableName string
    The route table name.
    RouterId string
    Router Id of the route table.
    RouterType string
    The route type.
    Status string
    The status of route table.
    Tags Dictionary<string, object>
    VpcId 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 []GetRouteTablesTable
    A list of Route Tables. Each element contains the following attributes:
    TotalCount int
    NameRegex string
    OutputFile string
    PageNumber int
    PageSize int
    ResourceGroupId string
    The Id of resource group which route tables belongs.
    RouteTableName string
    The route table name.
    RouterId string
    Router Id of the route table.
    RouterType string
    The route type.
    Status string
    The status of route table.
    Tags map[string]interface{}
    VpcId 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<GetRouteTablesTable>
    A list of Route Tables. Each element contains the following attributes:
    totalCount Integer
    nameRegex String
    outputFile String
    pageNumber Integer
    pageSize Integer
    resourceGroupId String
    The Id of resource group which route tables belongs.
    routeTableName String
    The route table name.
    routerId String
    Router Id of the route table.
    routerType String
    The route type.
    status String
    The status of route table.
    tags Map<String,Object>
    vpcId 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 GetRouteTablesTable[]
    A list of Route Tables. Each element contains the following attributes:
    totalCount number
    nameRegex string
    outputFile string
    pageNumber number
    pageSize number
    resourceGroupId string
    The Id of resource group which route tables belongs.
    routeTableName string
    The route table name.
    routerId string
    Router Id of the route table.
    routerType string
    The route type.
    status string
    The status of route table.
    tags {[key: string]: any}
    vpcId 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[GetRouteTablesTable]
    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_id str
    The Id of resource group which route tables belongs.
    route_table_name str
    The route table name.
    router_id str
    Router Id of the route table.
    router_type str
    The route type.
    status str
    The status of route table.
    tags Mapping[str, Any]
    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:
    totalCount Number
    nameRegex String
    outputFile String
    pageNumber Number
    pageSize Number
    resourceGroupId String
    The Id of resource group which route tables belongs.
    routeTableName String
    The route table name.
    routerId String
    Router Id of the route table.
    routerType String
    The route type.
    status String
    The status of route table.
    tags Map<Any>
    vpcId 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.
    ResourceGroupId string
    The Id of resource group which route tables belongs.
    RouteTableId string
    The route table id.
    RouteTableName string
    The route table name.
    RouteTableType string
    The type of route table.
    RouterId string
    The router ID.
    RouterType string
    The route type of route table. Valid values: VRouter and VBR.
    Status string
    The status of resource. Valid values: Available and Pending.
    Tags Dictionary<string, object>
    A mapping of tags to assign to the resource.
    VpcId string
    Vpc id of the route table.
    VswitchIds 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.
    ResourceGroupId string
    The Id of resource group which route tables belongs.
    RouteTableId string
    The route table id.
    RouteTableName string
    The route table name.
    RouteTableType string
    The type of route table.
    RouterId string
    The router ID.
    RouterType string
    The route type of route table. Valid values: VRouter and VBR.
    Status string
    The status of resource. Valid values: Available and Pending.
    Tags map[string]interface{}
    A mapping of tags to assign to the resource.
    VpcId string
    Vpc id of the route table.
    VswitchIds []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.
    resourceGroupId String
    The Id of resource group which route tables belongs.
    routeTableId String
    The route table id.
    routeTableName String
    The route table name.
    routeTableType String
    The type of route table.
    routerId String
    The router ID.
    routerType String
    The route type of route table. Valid values: VRouter and VBR.
    status String
    The status of resource. Valid values: Available and Pending.
    tags Map<String,Object>
    A mapping of tags to assign to the resource.
    vpcId String
    Vpc id of the route table.
    vswitchIds 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.
    resourceGroupId string
    The Id of resource group which route tables belongs.
    routeTableId string
    The route table id.
    routeTableName string
    The route table name.
    routeTableType string
    The type of route table.
    routerId string
    The router ID.
    routerType string
    The route type of route table. Valid values: VRouter and VBR.
    status string
    The status of resource. Valid values: Available and Pending.
    tags {[key: string]: any}
    A mapping of tags to assign to the resource.
    vpcId string
    Vpc id of the route table.
    vswitchIds 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_id str
    The Id of resource group which route tables belongs.
    route_table_id str
    The route table id.
    route_table_name str
    The route table name.
    route_table_type str
    The type of route table.
    router_id str
    The router ID.
    router_type str
    The route type of route table. Valid values: VRouter and VBR.
    status str
    The status of resource. Valid values: Available and Pending.
    tags Mapping[str, Any]
    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.
    resourceGroupId String
    The Id of resource group which route tables belongs.
    routeTableId String
    The route table id.
    routeTableName String
    The route table name.
    routeTableType String
    The type of route table.
    routerId String
    The router ID.
    routerType String
    The route type of route table. Valid values: VRouter and VBR.
    status String
    The status of resource. Valid values: Available and Pending.
    tags Map<Any>
    A mapping of tags to assign to the resource.
    vpcId String
    Vpc id of the route table.
    vswitchIds 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.
    alicloud logo
    Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi