tencentcloud 1.81.183 published on Wednesday, Apr 16, 2025 by tencentcloudstack
tencentcloud.getRouteTable
Explore with Pulumi AI
tencentcloud 1.81.183 published on Wednesday, Apr 16, 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 dictionaryThe following arguments are supported:
- Route
Table stringId  - The Route Table ID.
 - Id string
 - Name string
 - The Route Table name.
 
- Route
Table stringId  - The Route Table ID.
 - Id string
 - Name string
 - The Route Table name.
 
- route
Table StringId  - The Route Table ID.
 - id String
 - name String
 - The Route Table name.
 
- route
Table stringId  - The Route Table ID.
 - id string
 - name string
 - The Route Table name.
 
- route_
table_ strid  - The Route Table ID.
 - id str
 - name str
 - The Route Table name.
 
- route
Table StringId  - The Route Table ID.
 - id String
 - name String
 - The Route Table name.
 
getRouteTable Result
The following output properties are available:
- Create
Time string - Creation time of routing table.
 - Id string
 - Route
Table stringId  - Routes
List<Get
Route Table Route>  - The information list of the VPC route table.
 - Subnet
Num double - Number of associated subnets.
 - Vpc
Id string - The VPC ID.
 - Name string
 
- Create
Time string - Creation time of routing table.
 - Id string
 - Route
Table stringId  - Routes
[]Get
Route Table Route  - The information list of the VPC route table.
 - Subnet
Num float64 - Number of associated subnets.
 - Vpc
Id string - The VPC ID.
 - Name string
 
- create
Time String - Creation time of routing table.
 - id String
 - route
Table StringId  - routes
List<Get
Route Table Route>  - The information list of the VPC route table.
 - subnet
Num Double - Number of associated subnets.
 - vpc
Id String - The VPC ID.
 - name String
 
- create
Time string - Creation time of routing table.
 - id string
 - route
Table stringId  - routes
Get
Route Table Route[]  - The information list of the VPC route table.
 - subnet
Num number - Number of associated subnets.
 - vpc
Id string - The VPC ID.
 - name string
 
- create_
time str - Creation time of routing table.
 - id str
 - route_
table_ strid  - routes
Sequence[Get
Route Table Route]  - The information list of the VPC route table.
 - subnet_
num float - Number of associated subnets.
 - vpc_
id str - The VPC ID.
 - name str
 
- create
Time String - Creation time of routing table.
 - id String
 - route
Table StringId  - routes List<Property Map>
 - The information list of the VPC route table.
 - subnet
Num Number - Number of associated subnets.
 - vpc
Id String - The VPC ID.
 - name String
 
Supporting Types
GetRouteTableRoute   
- Cidr
Block string - The RouteEntry's target network segment.
 - Description string
 - The RouteEntry's description.
 - Next
Hub string - The RouteEntry's next hub.
 - Next
Type string - The 
next_hubtype. 
- Cidr
Block string - The RouteEntry's target network segment.
 - Description string
 - The RouteEntry's description.
 - Next
Hub string - The RouteEntry's next hub.
 - Next
Type string - The 
next_hubtype. 
- cidr
Block String - The RouteEntry's target network segment.
 - description String
 - The RouteEntry's description.
 - next
Hub String - The RouteEntry's next hub.
 - next
Type String - The 
next_hubtype. 
- cidr
Block string - The RouteEntry's target network segment.
 - description string
 - The RouteEntry's description.
 - next
Hub string - The RouteEntry's next hub.
 - next
Type string - The 
next_hubtype. 
- 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_hubtype. 
- cidr
Block String - The RouteEntry's target network segment.
 - description String
 - The RouteEntry's description.
 - next
Hub String - The RouteEntry's next hub.
 - next
Type String - The 
next_hubtype. 
Package Details
- Repository
 - tencentcloud tencentcloudstack/terraform-provider-tencentcloud
 - License
 - Notes
 - This Pulumi package is based on the 
tencentcloudTerraform Provider. 
tencentcloud 1.81.183 published on Wednesday, Apr 16, 2025 by tencentcloudstack