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

tencentcloud.getVpcRouteTables

Explore with Pulumi AI

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

    Use this data source to query vpc route tables information.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const config = new pulumi.Config();
    const availabilityZone = config.get("availabilityZone") || "ap-guangzhou-3";
    const foo = new tencentcloud.Vpc("foo", {cidrBlock: "10.0.0.0/16"});
    const routeTable = new tencentcloud.RouteTable("routeTable", {
        vpcId: foo.vpcId,
        tags: {
            test: "test",
        },
    });
    const idInstances = tencentcloud.getVpcRouteTablesOutput({
        routeTableId: routeTable.routeTableId,
    });
    const nameInstances = tencentcloud.getVpcRouteTablesOutput({
        name: routeTable.name,
    });
    const vpcDefaultInstance = tencentcloud.getVpcRouteTablesOutput({
        vpcId: foo.vpcId,
        associationMain: true,
    });
    const tagsInstances = routeTable.tags.apply(tags => tencentcloud.getVpcRouteTablesOutput({
        tags: tags,
    }));
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    config = pulumi.Config()
    availability_zone = config.get("availabilityZone")
    if availability_zone is None:
        availability_zone = "ap-guangzhou-3"
    foo = tencentcloud.Vpc("foo", cidr_block="10.0.0.0/16")
    route_table = tencentcloud.RouteTable("routeTable",
        vpc_id=foo.vpc_id,
        tags={
            "test": "test",
        })
    id_instances = tencentcloud.get_vpc_route_tables_output(route_table_id=route_table.route_table_id)
    name_instances = tencentcloud.get_vpc_route_tables_output(name=route_table.name)
    vpc_default_instance = tencentcloud.get_vpc_route_tables_output(vpc_id=foo.vpc_id,
        association_main=True)
    tags_instances = route_table.tags.apply(lambda tags: tencentcloud.get_vpc_route_tables_output(tags=tags))
    
    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, "")
    		availabilityZone := "ap-guangzhou-3"
    		if param := cfg.Get("availabilityZone"); param != "" {
    			availabilityZone = param
    		}
    		foo, err := tencentcloud.NewVpc(ctx, "foo", &tencentcloud.VpcArgs{
    			CidrBlock: pulumi.String("10.0.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		routeTable, err := tencentcloud.NewRouteTable(ctx, "routeTable", &tencentcloud.RouteTableArgs{
    			VpcId: foo.VpcId,
    			Tags: pulumi.StringMap{
    				"test": pulumi.String("test"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_ = tencentcloud.GetVpcRouteTablesOutput(ctx, tencentcloud.GetVpcRouteTablesOutputArgs{
    			RouteTableId: routeTable.RouteTableId,
    		}, nil)
    		_ = tencentcloud.GetVpcRouteTablesOutput(ctx, tencentcloud.GetVpcRouteTablesOutputArgs{
    			Name: routeTable.Name,
    		}, nil)
    		_ = tencentcloud.GetVpcRouteTablesOutput(ctx, tencentcloud.GetVpcRouteTablesOutputArgs{
    			VpcId:           foo.VpcId,
    			AssociationMain: pulumi.Bool(true),
    		}, nil)
    		_ = routeTable.Tags.ApplyT(func(tags map[string]string) (tencentcloud.GetVpcRouteTablesResult, error) {
    			return tencentcloud.GetVpcRouteTablesResult(interface{}(tencentcloud.GetVpcRouteTablesOutput(ctx, tencentcloud.GetVpcRouteTablesOutputArgs{
    				Tags: tags,
    			}, nil))), nil
    		}).(tencentcloud.GetVpcRouteTablesResultOutput)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var availabilityZone = config.Get("availabilityZone") ?? "ap-guangzhou-3";
        var foo = new Tencentcloud.Vpc("foo", new()
        {
            CidrBlock = "10.0.0.0/16",
        });
    
        var routeTable = new Tencentcloud.RouteTable("routeTable", new()
        {
            VpcId = foo.VpcId,
            Tags = 
            {
                { "test", "test" },
            },
        });
    
        var idInstances = Tencentcloud.GetVpcRouteTables.Invoke(new()
        {
            RouteTableId = routeTable.RouteTableId,
        });
    
        var nameInstances = Tencentcloud.GetVpcRouteTables.Invoke(new()
        {
            Name = routeTable.Name,
        });
    
        var vpcDefaultInstance = Tencentcloud.GetVpcRouteTables.Invoke(new()
        {
            VpcId = foo.VpcId,
            AssociationMain = true,
        });
    
        var tagsInstances = Tencentcloud.GetVpcRouteTables.Invoke(new()
        {
            Tags = routeTable.Tags,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.Vpc;
    import com.pulumi.tencentcloud.VpcArgs;
    import com.pulumi.tencentcloud.RouteTable;
    import com.pulumi.tencentcloud.RouteTableArgs;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetVpcRouteTablesArgs;
    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 availabilityZone = config.get("availabilityZone").orElse("ap-guangzhou-3");
            var foo = new Vpc("foo", VpcArgs.builder()
                .cidrBlock("10.0.0.0/16")
                .build());
    
            var routeTable = new RouteTable("routeTable", RouteTableArgs.builder()
                .vpcId(foo.vpcId())
                .tags(Map.of("test", "test"))
                .build());
    
            final var idInstances = TencentcloudFunctions.getVpcRouteTables(GetVpcRouteTablesArgs.builder()
                .routeTableId(routeTable.routeTableId())
                .build());
    
            final var nameInstances = TencentcloudFunctions.getVpcRouteTables(GetVpcRouteTablesArgs.builder()
                .name(routeTable.name())
                .build());
    
            final var vpcDefaultInstance = TencentcloudFunctions.getVpcRouteTables(GetVpcRouteTablesArgs.builder()
                .vpcId(foo.vpcId())
                .associationMain(true)
                .build());
    
            final var tagsInstances = TencentcloudFunctions.getVpcRouteTables(GetVpcRouteTablesArgs.builder()
                .tags(routeTable.tags())
                .build());
    
        }
    }
    
    configuration:
      availabilityZone:
        type: string
        default: ap-guangzhou-3
    resources:
      foo:
        type: tencentcloud:Vpc
        properties:
          cidrBlock: 10.0.0.0/16
      routeTable:
        type: tencentcloud:RouteTable
        properties:
          vpcId: ${foo.vpcId}
          tags:
            test: test
    variables:
      idInstances:
        fn::invoke:
          function: tencentcloud:getVpcRouteTables
          arguments:
            routeTableId: ${routeTable.routeTableId}
      nameInstances:
        fn::invoke:
          function: tencentcloud:getVpcRouteTables
          arguments:
            name: ${routeTable.name}
      vpcDefaultInstance:
        fn::invoke:
          function: tencentcloud:getVpcRouteTables
          arguments:
            vpcId: ${foo.vpcId}
            associationMain: true
      tagsInstances:
        fn::invoke:
          function: tencentcloud:getVpcRouteTables
          arguments:
            tags: ${routeTable.tags}
    

    Using getVpcRouteTables

    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 getVpcRouteTables(args: GetVpcRouteTablesArgs, opts?: InvokeOptions): Promise<GetVpcRouteTablesResult>
    function getVpcRouteTablesOutput(args: GetVpcRouteTablesOutputArgs, opts?: InvokeOptions): Output<GetVpcRouteTablesResult>
    def get_vpc_route_tables(association_main: Optional[bool] = None,
                             id: Optional[str] = None,
                             name: Optional[str] = None,
                             result_output_file: Optional[str] = None,
                             route_table_id: Optional[str] = None,
                             tag_key: Optional[str] = None,
                             tags: Optional[Mapping[str, str]] = None,
                             vpc_id: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetVpcRouteTablesResult
    def get_vpc_route_tables_output(association_main: Optional[pulumi.Input[bool]] = None,
                             id: Optional[pulumi.Input[str]] = None,
                             name: Optional[pulumi.Input[str]] = None,
                             result_output_file: Optional[pulumi.Input[str]] = None,
                             route_table_id: Optional[pulumi.Input[str]] = None,
                             tag_key: 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[GetVpcRouteTablesResult]
    func GetVpcRouteTables(ctx *Context, args *GetVpcRouteTablesArgs, opts ...InvokeOption) (*GetVpcRouteTablesResult, error)
    func GetVpcRouteTablesOutput(ctx *Context, args *GetVpcRouteTablesOutputArgs, opts ...InvokeOption) GetVpcRouteTablesResultOutput

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

    public static class GetVpcRouteTables 
    {
        public static Task<GetVpcRouteTablesResult> InvokeAsync(GetVpcRouteTablesArgs args, InvokeOptions? opts = null)
        public static Output<GetVpcRouteTablesResult> Invoke(GetVpcRouteTablesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVpcRouteTablesResult> getVpcRouteTables(GetVpcRouteTablesArgs args, InvokeOptions options)
    public static Output<GetVpcRouteTablesResult> getVpcRouteTables(GetVpcRouteTablesArgs args, InvokeOptions options)
    
    fn::invoke:
      function: tencentcloud:index/getVpcRouteTables:getVpcRouteTables
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AssociationMain bool
    Filter the main routing table.
    Id string
    Name string
    Name of the routing table to be queried.
    ResultOutputFile string
    Used to save results.
    RouteTableId string
    ID of the routing table to be queried.
    TagKey string
    Filter if routing table has this tag.
    Tags Dictionary<string, string>
    Tags of the routing table to be queried.
    VpcId string
    ID of the VPC to be queried.
    AssociationMain bool
    Filter the main routing table.
    Id string
    Name string
    Name of the routing table to be queried.
    ResultOutputFile string
    Used to save results.
    RouteTableId string
    ID of the routing table to be queried.
    TagKey string
    Filter if routing table has this tag.
    Tags map[string]string
    Tags of the routing table to be queried.
    VpcId string
    ID of the VPC to be queried.
    associationMain Boolean
    Filter the main routing table.
    id String
    name String
    Name of the routing table to be queried.
    resultOutputFile String
    Used to save results.
    routeTableId String
    ID of the routing table to be queried.
    tagKey String
    Filter if routing table has this tag.
    tags Map<String,String>
    Tags of the routing table to be queried.
    vpcId String
    ID of the VPC to be queried.
    associationMain boolean
    Filter the main routing table.
    id string
    name string
    Name of the routing table to be queried.
    resultOutputFile string
    Used to save results.
    routeTableId string
    ID of the routing table to be queried.
    tagKey string
    Filter if routing table has this tag.
    tags {[key: string]: string}
    Tags of the routing table to be queried.
    vpcId string
    ID of the VPC to be queried.
    association_main bool
    Filter the main routing table.
    id str
    name str
    Name of the routing table to be queried.
    result_output_file str
    Used to save results.
    route_table_id str
    ID of the routing table to be queried.
    tag_key str
    Filter if routing table has this tag.
    tags Mapping[str, str]
    Tags of the routing table to be queried.
    vpc_id str
    ID of the VPC to be queried.
    associationMain Boolean
    Filter the main routing table.
    id String
    name String
    Name of the routing table to be queried.
    resultOutputFile String
    Used to save results.
    routeTableId String
    ID of the routing table to be queried.
    tagKey String
    Filter if routing table has this tag.
    tags Map<String>
    Tags of the routing table to be queried.
    vpcId String
    ID of the VPC to be queried.

    getVpcRouteTables Result

    The following output properties are available:

    Id string
    InstanceLists List<GetVpcRouteTablesInstanceList>
    The information list of the VPC route table.
    AssociationMain bool
    Name string
    Name of the routing table.
    ResultOutputFile string
    RouteTableId string
    ID of the routing table.
    TagKey string
    Tags Dictionary<string, string>
    Tags of the routing table.
    VpcId string
    ID of the VPC.
    Id string
    InstanceLists []GetVpcRouteTablesInstanceList
    The information list of the VPC route table.
    AssociationMain bool
    Name string
    Name of the routing table.
    ResultOutputFile string
    RouteTableId string
    ID of the routing table.
    TagKey string
    Tags map[string]string
    Tags of the routing table.
    VpcId string
    ID of the VPC.
    id String
    instanceLists List<GetVpcRouteTablesInstanceList>
    The information list of the VPC route table.
    associationMain Boolean
    name String
    Name of the routing table.
    resultOutputFile String
    routeTableId String
    ID of the routing table.
    tagKey String
    tags Map<String,String>
    Tags of the routing table.
    vpcId String
    ID of the VPC.
    id string
    instanceLists GetVpcRouteTablesInstanceList[]
    The information list of the VPC route table.
    associationMain boolean
    name string
    Name of the routing table.
    resultOutputFile string
    routeTableId string
    ID of the routing table.
    tagKey string
    tags {[key: string]: string}
    Tags of the routing table.
    vpcId string
    ID of the VPC.
    id str
    instance_lists Sequence[GetVpcRouteTablesInstanceList]
    The information list of the VPC route table.
    association_main bool
    name str
    Name of the routing table.
    result_output_file str
    route_table_id str
    ID of the routing table.
    tag_key str
    tags Mapping[str, str]
    Tags of the routing table.
    vpc_id str
    ID of the VPC.
    id String
    instanceLists List<Property Map>
    The information list of the VPC route table.
    associationMain Boolean
    name String
    Name of the routing table.
    resultOutputFile String
    routeTableId String
    ID of the routing table.
    tagKey String
    tags Map<String>
    Tags of the routing table.
    vpcId String
    ID of the VPC.

    Supporting Types

    GetVpcRouteTablesInstanceList

    CreateTime string
    Creation time of the routing table.
    IsDefault bool
    Indicates whether it is the default routing table.
    Name string
    Name of the routing table to be queried.
    RouteEntryInfos List<GetVpcRouteTablesInstanceListRouteEntryInfo>
    Detailed information of each entry of the route table.
    RouteTableId string
    ID of the routing table to be queried.
    SubnetIds List<string>
    List of subnet IDs bound to the route table.
    Tags Dictionary<string, string>
    Tags of the routing table to be queried.
    VpcId string
    ID of the VPC to be queried.
    CreateTime string
    Creation time of the routing table.
    IsDefault bool
    Indicates whether it is the default routing table.
    Name string
    Name of the routing table to be queried.
    RouteEntryInfos []GetVpcRouteTablesInstanceListRouteEntryInfo
    Detailed information of each entry of the route table.
    RouteTableId string
    ID of the routing table to be queried.
    SubnetIds []string
    List of subnet IDs bound to the route table.
    Tags map[string]string
    Tags of the routing table to be queried.
    VpcId string
    ID of the VPC to be queried.
    createTime String
    Creation time of the routing table.
    isDefault Boolean
    Indicates whether it is the default routing table.
    name String
    Name of the routing table to be queried.
    routeEntryInfos List<GetVpcRouteTablesInstanceListRouteEntryInfo>
    Detailed information of each entry of the route table.
    routeTableId String
    ID of the routing table to be queried.
    subnetIds List<String>
    List of subnet IDs bound to the route table.
    tags Map<String,String>
    Tags of the routing table to be queried.
    vpcId String
    ID of the VPC to be queried.
    createTime string
    Creation time of the routing table.
    isDefault boolean
    Indicates whether it is the default routing table.
    name string
    Name of the routing table to be queried.
    routeEntryInfos GetVpcRouteTablesInstanceListRouteEntryInfo[]
    Detailed information of each entry of the route table.
    routeTableId string
    ID of the routing table to be queried.
    subnetIds string[]
    List of subnet IDs bound to the route table.
    tags {[key: string]: string}
    Tags of the routing table to be queried.
    vpcId string
    ID of the VPC to be queried.
    create_time str
    Creation time of the routing table.
    is_default bool
    Indicates whether it is the default routing table.
    name str
    Name of the routing table to be queried.
    route_entry_infos Sequence[GetVpcRouteTablesInstanceListRouteEntryInfo]
    Detailed information of each entry of the route table.
    route_table_id str
    ID of the routing table to be queried.
    subnet_ids Sequence[str]
    List of subnet IDs bound to the route table.
    tags Mapping[str, str]
    Tags of the routing table to be queried.
    vpc_id str
    ID of the VPC to be queried.
    createTime String
    Creation time of the routing table.
    isDefault Boolean
    Indicates whether it is the default routing table.
    name String
    Name of the routing table to be queried.
    routeEntryInfos List<Property Map>
    Detailed information of each entry of the route table.
    routeTableId String
    ID of the routing table to be queried.
    subnetIds List<String>
    List of subnet IDs bound to the route table.
    tags Map<String>
    Tags of the routing table to be queried.
    vpcId String
    ID of the VPC to be queried.

    GetVpcRouteTablesInstanceListRouteEntryInfo

    Description string
    Description information user defined for a route table rule.
    DestinationCidrBlock string
    The destination address block.
    NextHub string
    ID of next-hop gateway. Note: when 'next_type' is EIP, GatewayId will fix the value 0.
    NextType string
    Type of next-hop, and available values include CVM, VPN, DIRECTCONNECT, PEERCONNECTION, SSLVPN, NAT, NORMAL_CVM, EIP and CCN.
    RouteEntryId string
    ID of a route table entry.
    Description string
    Description information user defined for a route table rule.
    DestinationCidrBlock string
    The destination address block.
    NextHub string
    ID of next-hop gateway. Note: when 'next_type' is EIP, GatewayId will fix the value 0.
    NextType string
    Type of next-hop, and available values include CVM, VPN, DIRECTCONNECT, PEERCONNECTION, SSLVPN, NAT, NORMAL_CVM, EIP and CCN.
    RouteEntryId string
    ID of a route table entry.
    description String
    Description information user defined for a route table rule.
    destinationCidrBlock String
    The destination address block.
    nextHub String
    ID of next-hop gateway. Note: when 'next_type' is EIP, GatewayId will fix the value 0.
    nextType String
    Type of next-hop, and available values include CVM, VPN, DIRECTCONNECT, PEERCONNECTION, SSLVPN, NAT, NORMAL_CVM, EIP and CCN.
    routeEntryId String
    ID of a route table entry.
    description string
    Description information user defined for a route table rule.
    destinationCidrBlock string
    The destination address block.
    nextHub string
    ID of next-hop gateway. Note: when 'next_type' is EIP, GatewayId will fix the value 0.
    nextType string
    Type of next-hop, and available values include CVM, VPN, DIRECTCONNECT, PEERCONNECTION, SSLVPN, NAT, NORMAL_CVM, EIP and CCN.
    routeEntryId string
    ID of a route table entry.
    description str
    Description information user defined for a route table rule.
    destination_cidr_block str
    The destination address block.
    next_hub str
    ID of next-hop gateway. Note: when 'next_type' is EIP, GatewayId will fix the value 0.
    next_type str
    Type of next-hop, and available values include CVM, VPN, DIRECTCONNECT, PEERCONNECTION, SSLVPN, NAT, NORMAL_CVM, EIP and CCN.
    route_entry_id str
    ID of a route table entry.
    description String
    Description information user defined for a route table rule.
    destinationCidrBlock String
    The destination address block.
    nextHub String
    ID of next-hop gateway. Note: when 'next_type' is EIP, GatewayId will fix the value 0.
    nextType String
    Type of next-hop, and available values include CVM, VPN, DIRECTCONNECT, PEERCONNECTION, SSLVPN, NAT, NORMAL_CVM, EIP and CCN.
    routeEntryId String
    ID of a route table entry.

    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