1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. getRouteTable
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.getRouteTable

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Provides details about a specific Route Table.

    This resource can prove useful when a module accepts a Subnet id as an input variable and needs to, for example, add a route in the Route Table.

    NOTE: It has been deprecated and replaced by tencentcloud_vpc_route_tables.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const config = new pulumi.Config();
    const routeTableId = config.requireObject("routeTableId");
    const selected = tencentcloud.getRouteTable({
        routeTableId: routeTableId,
    });
    const rtbEntryInstance = new tencentcloud.RouteEntry("rtbEntryInstance", {
        vpcId: "{data.tencentcloud_route_table.selected.vpc_id}",
        routeTableId: routeTableId,
        cidrBlock: "10.4.8.0/24",
        nextType: "instance",
        nextHub: "10.16.1.7",
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    config = pulumi.Config()
    route_table_id = config.require_object("routeTableId")
    selected = tencentcloud.get_route_table(route_table_id=route_table_id)
    rtb_entry_instance = tencentcloud.RouteEntry("rtbEntryInstance",
        vpc_id="{data.tencentcloud_route_table.selected.vpc_id}",
        route_table_id=route_table_id,
        cidr_block="10.4.8.0/24",
        next_type="instance",
        next_hub="10.16.1.7")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"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, "")
    		routeTableId := cfg.RequireObject("routeTableId")
    		_, err := tencentcloud.LookupRouteTable(ctx, &tencentcloud.LookupRouteTableArgs{
    			RouteTableId: routeTableId,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = tencentcloud.NewRouteEntry(ctx, "rtbEntryInstance", &tencentcloud.RouteEntryArgs{
    			VpcId:        pulumi.String("{data.tencentcloud_route_table.selected.vpc_id}"),
    			RouteTableId: pulumi.Any(routeTableId),
    			CidrBlock:    pulumi.String("10.4.8.0/24"),
    			NextType:     pulumi.String("instance"),
    			NextHub:      pulumi.String("10.16.1.7"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var routeTableId = config.RequireObject<dynamic>("routeTableId");
        var selected = Tencentcloud.GetRouteTable.Invoke(new()
        {
            RouteTableId = routeTableId,
        });
    
        var rtbEntryInstance = new Tencentcloud.RouteEntry("rtbEntryInstance", new()
        {
            VpcId = "{data.tencentcloud_route_table.selected.vpc_id}",
            RouteTableId = routeTableId,
            CidrBlock = "10.4.8.0/24",
            NextType = "instance",
            NextHub = "10.16.1.7",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetRouteTableArgs;
    import com.pulumi.tencentcloud.RouteEntry;
    import com.pulumi.tencentcloud.RouteEntryArgs;
    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 routeTableId = config.get("routeTableId");
            final var selected = TencentcloudFunctions.getRouteTable(GetRouteTableArgs.builder()
                .routeTableId(routeTableId)
                .build());
    
            var rtbEntryInstance = new RouteEntry("rtbEntryInstance", RouteEntryArgs.builder()
                .vpcId("{data.tencentcloud_route_table.selected.vpc_id}")
                .routeTableId(routeTableId)
                .cidrBlock("10.4.8.0/24")
                .nextType("instance")
                .nextHub("10.16.1.7")
                .build());
    
        }
    }
    
    configuration:
      routeTableId:
        type: dynamic
    resources:
      rtbEntryInstance:
        type: tencentcloud:RouteEntry
        properties:
          vpcId: '{data.tencentcloud_route_table.selected.vpc_id}'
          routeTableId: ${routeTableId}
          cidrBlock: 10.4.8.0/24
          nextType: instance
          nextHub: 10.16.1.7
    variables:
      selected:
        fn::invoke:
          function: tencentcloud:getRouteTable
          arguments:
            routeTableId: ${routeTableId}
    

    Using getRouteTable

    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 getRouteTable(args: GetRouteTableArgs, opts?: InvokeOptions): Promise<GetRouteTableResult>
    function getRouteTableOutput(args: GetRouteTableOutputArgs, opts?: InvokeOptions): Output<GetRouteTableResult>
    def get_route_table(id: Optional[str] = None,
                        name: Optional[str] = None,
                        route_table_id: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetRouteTableResult
    def get_route_table_output(id: Optional[pulumi.Input[str]] = None,
                        name: Optional[pulumi.Input[str]] = None,
                        route_table_id: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetRouteTableResult]
    func LookupRouteTable(ctx *Context, args *LookupRouteTableArgs, opts ...InvokeOption) (*LookupRouteTableResult, error)
    func LookupRouteTableOutput(ctx *Context, args *LookupRouteTableOutputArgs, opts ...InvokeOption) LookupRouteTableResultOutput

    > Note: This function is named LookupRouteTable in the Go SDK.

    public static class GetRouteTable 
    {
        public static Task<GetRouteTableResult> InvokeAsync(GetRouteTableArgs args, InvokeOptions? opts = null)
        public static Output<GetRouteTableResult> Invoke(GetRouteTableInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRouteTableResult> getRouteTable(GetRouteTableArgs args, InvokeOptions options)
    public static Output<GetRouteTableResult> getRouteTable(GetRouteTableArgs args, InvokeOptions options)
    
    fn::invoke:
      function: tencentcloud:index/getRouteTable:getRouteTable
      arguments:
        # arguments dictionary

    The following arguments are supported:

    RouteTableId string
    The Route Table ID.
    Id string
    Name string
    The Route Table name.
    RouteTableId string
    The Route Table ID.
    Id string
    Name string
    The Route Table name.
    routeTableId String
    The Route Table ID.
    id String
    name String
    The Route Table name.
    routeTableId string
    The Route Table ID.
    id string
    name string
    The Route Table name.
    route_table_id str
    The Route Table ID.
    id str
    name str
    The Route Table name.
    routeTableId String
    The Route Table ID.
    id String
    name String
    The Route Table name.

    getRouteTable Result

    The following output properties are available:

    CreateTime string
    Creation time of routing table.
    Id string
    RouteTableId string
    Routes List<GetRouteTableRoute>
    The information list of the VPC route table.
    SubnetNum double
    Number of associated subnets.
    VpcId string
    The VPC ID.
    Name string
    CreateTime string
    Creation time of routing table.
    Id string
    RouteTableId string
    Routes []GetRouteTableRoute
    The information list of the VPC route table.
    SubnetNum float64
    Number of associated subnets.
    VpcId string
    The VPC ID.
    Name string
    createTime String
    Creation time of routing table.
    id String
    routeTableId String
    routes List<GetRouteTableRoute>
    The information list of the VPC route table.
    subnetNum Double
    Number of associated subnets.
    vpcId String
    The VPC ID.
    name String
    createTime string
    Creation time of routing table.
    id string
    routeTableId string
    routes GetRouteTableRoute[]
    The information list of the VPC route table.
    subnetNum number
    Number of associated subnets.
    vpcId string
    The VPC ID.
    name string
    create_time str
    Creation time of routing table.
    id str
    route_table_id str
    routes Sequence[GetRouteTableRoute]
    The information list of the VPC route table.
    subnet_num float
    Number of associated subnets.
    vpc_id str
    The VPC ID.
    name str
    createTime String
    Creation time of routing table.
    id String
    routeTableId String
    routes List<Property Map>
    The information list of the VPC route table.
    subnetNum Number
    Number of associated subnets.
    vpcId String
    The VPC ID.
    name String

    Supporting Types

    GetRouteTableRoute

    CidrBlock string
    The RouteEntry's target network segment.
    Description string
    The RouteEntry's description.
    NextHub string
    The RouteEntry's next hub.
    NextType string
    The next_hub type.
    CidrBlock string
    The RouteEntry's target network segment.
    Description string
    The RouteEntry's description.
    NextHub string
    The RouteEntry's next hub.
    NextType string
    The next_hub type.
    cidrBlock String
    The RouteEntry's target network segment.
    description String
    The RouteEntry's description.
    nextHub String
    The RouteEntry's next hub.
    nextType String
    The next_hub type.
    cidrBlock string
    The RouteEntry's target network segment.
    description string
    The RouteEntry's description.
    nextHub string
    The RouteEntry's next hub.
    nextType string
    The next_hub type.
    cidr_block str
    The RouteEntry's target network segment.
    description str
    The RouteEntry's description.
    next_hub str
    The RouteEntry's next hub.
    next_type str
    The next_hub type.
    cidrBlock String
    The RouteEntry's target network segment.
    description String
    The RouteEntry's description.
    nextHub String
    The RouteEntry's next hub.
    nextType String
    The next_hub type.

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack