AWS v6.73.0 published on Wednesday, Mar 19, 2025 by Pulumi
aws.ec2transitgateway.getRouteTable
Explore with Pulumi AI
Get information on an EC2 Transit Gateway Route Table.
Example Usage
By Filter
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.ec2transitgateway.getRouteTable({
    filters: [
        {
            name: "default-association-route-table",
            values: ["true"],
        },
        {
            name: "transit-gateway-id",
            values: ["tgw-12345678"],
        },
    ],
});
import pulumi
import pulumi_aws as aws
example = aws.ec2transitgateway.get_route_table(filters=[
    {
        "name": "default-association-route-table",
        "values": ["true"],
    },
    {
        "name": "transit-gateway-id",
        "values": ["tgw-12345678"],
    },
])
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2transitgateway.LookupRouteTable(ctx, &ec2transitgateway.LookupRouteTableArgs{
			Filters: []ec2transitgateway.GetRouteTableFilter{
				{
					Name: "default-association-route-table",
					Values: []string{
						"true",
					},
				},
				{
					Name: "transit-gateway-id",
					Values: []string{
						"tgw-12345678",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var example = Aws.Ec2TransitGateway.GetRouteTable.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ec2TransitGateway.Inputs.GetRouteTableFilterInputArgs
            {
                Name = "default-association-route-table",
                Values = new[]
                {
                    "true",
                },
            },
            new Aws.Ec2TransitGateway.Inputs.GetRouteTableFilterInputArgs
            {
                Name = "transit-gateway-id",
                Values = new[]
                {
                    "tgw-12345678",
                },
            },
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.Ec2transitgatewayFunctions;
import com.pulumi.aws.ec2transitgateway.inputs.GetRouteTableArgs;
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 example = Ec2transitgatewayFunctions.getRouteTable(GetRouteTableArgs.builder()
            .filters(            
                GetRouteTableFilterArgs.builder()
                    .name("default-association-route-table")
                    .values("true")
                    .build(),
                GetRouteTableFilterArgs.builder()
                    .name("transit-gateway-id")
                    .values("tgw-12345678")
                    .build())
            .build());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:ec2transitgateway:getRouteTable
      arguments:
        filters:
          - name: default-association-route-table
            values:
              - 'true'
          - name: transit-gateway-id
            values:
              - tgw-12345678
By Identifier
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.ec2transitgateway.getRouteTable({
    id: "tgw-rtb-12345678",
});
import pulumi
import pulumi_aws as aws
example = aws.ec2transitgateway.get_route_table(id="tgw-rtb-12345678")
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2transitgateway.LookupRouteTable(ctx, &ec2transitgateway.LookupRouteTableArgs{
			Id: pulumi.StringRef("tgw-rtb-12345678"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var example = Aws.Ec2TransitGateway.GetRouteTable.Invoke(new()
    {
        Id = "tgw-rtb-12345678",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.Ec2transitgatewayFunctions;
import com.pulumi.aws.ec2transitgateway.inputs.GetRouteTableArgs;
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 example = Ec2transitgatewayFunctions.getRouteTable(GetRouteTableArgs.builder()
            .id("tgw-rtb-12345678")
            .build());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:ec2transitgateway:getRouteTable
      arguments:
        id: tgw-rtb-12345678
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(filters: Optional[Sequence[GetRouteTableFilter]] = None,
                    id: Optional[str] = None,
                    tags: Optional[Mapping[str, str]] = None,
                    opts: Optional[InvokeOptions] = None) -> GetRouteTableResult
def get_route_table_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetRouteTableFilterArgs]]]] = None,
                    id: Optional[pulumi.Input[str]] = None,
                    tags: Optional[pulumi.Input[Mapping[str, 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: aws:ec2transitgateway/getRouteTable:getRouteTable
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Filters
List<GetRoute Table Filter> 
- One or more configuration blocks containing name-values filters. Detailed below.
- Id string
- Identifier of the EC2 Transit Gateway Route Table.
- Dictionary<string, string>
- Key-value tags for the EC2 Transit Gateway Route Table
- Filters
[]GetRoute Table Filter 
- One or more configuration blocks containing name-values filters. Detailed below.
- Id string
- Identifier of the EC2 Transit Gateway Route Table.
- map[string]string
- Key-value tags for the EC2 Transit Gateway Route Table
- filters
List<GetRoute Table Filter> 
- One or more configuration blocks containing name-values filters. Detailed below.
- id String
- Identifier of the EC2 Transit Gateway Route Table.
- Map<String,String>
- Key-value tags for the EC2 Transit Gateway Route Table
- filters
GetRoute Table Filter[] 
- One or more configuration blocks containing name-values filters. Detailed below.
- id string
- Identifier of the EC2 Transit Gateway Route Table.
- {[key: string]: string}
- Key-value tags for the EC2 Transit Gateway Route Table
- filters
Sequence[GetRoute Table Filter] 
- One or more configuration blocks containing name-values filters. Detailed below.
- id str
- Identifier of the EC2 Transit Gateway Route Table.
- Mapping[str, str]
- Key-value tags for the EC2 Transit Gateway Route Table
- filters List<Property Map>
- One or more configuration blocks containing name-values filters. Detailed below.
- id String
- Identifier of the EC2 Transit Gateway Route Table.
- Map<String>
- Key-value tags for the EC2 Transit Gateway Route Table
getRouteTable Result
The following output properties are available:
- Arn string
- EC2 Transit Gateway Route Table ARN.
- DefaultAssociation boolRoute Table 
- Boolean whether this is the default association route table for the EC2 Transit Gateway
- DefaultPropagation boolRoute Table 
- Boolean whether this is the default propagation route table for the EC2 Transit Gateway
- Id string
- EC2 Transit Gateway Route Table identifier
- Dictionary<string, string>
- Key-value tags for the EC2 Transit Gateway Route Table
- TransitGateway stringId 
- EC2 Transit Gateway identifier
- Filters
List<GetRoute Table Filter> 
- Arn string
- EC2 Transit Gateway Route Table ARN.
- DefaultAssociation boolRoute Table 
- Boolean whether this is the default association route table for the EC2 Transit Gateway
- DefaultPropagation boolRoute Table 
- Boolean whether this is the default propagation route table for the EC2 Transit Gateway
- Id string
- EC2 Transit Gateway Route Table identifier
- map[string]string
- Key-value tags for the EC2 Transit Gateway Route Table
- TransitGateway stringId 
- EC2 Transit Gateway identifier
- Filters
[]GetRoute Table Filter 
- arn String
- EC2 Transit Gateway Route Table ARN.
- defaultAssociation BooleanRoute Table 
- Boolean whether this is the default association route table for the EC2 Transit Gateway
- defaultPropagation BooleanRoute Table 
- Boolean whether this is the default propagation route table for the EC2 Transit Gateway
- id String
- EC2 Transit Gateway Route Table identifier
- Map<String,String>
- Key-value tags for the EC2 Transit Gateway Route Table
- transitGateway StringId 
- EC2 Transit Gateway identifier
- filters
List<GetRoute Table Filter> 
- arn string
- EC2 Transit Gateway Route Table ARN.
- defaultAssociation booleanRoute Table 
- Boolean whether this is the default association route table for the EC2 Transit Gateway
- defaultPropagation booleanRoute Table 
- Boolean whether this is the default propagation route table for the EC2 Transit Gateway
- id string
- EC2 Transit Gateway Route Table identifier
- {[key: string]: string}
- Key-value tags for the EC2 Transit Gateway Route Table
- transitGateway stringId 
- EC2 Transit Gateway identifier
- filters
GetRoute Table Filter[] 
- arn str
- EC2 Transit Gateway Route Table ARN.
- default_association_ boolroute_ table 
- Boolean whether this is the default association route table for the EC2 Transit Gateway
- default_propagation_ boolroute_ table 
- Boolean whether this is the default propagation route table for the EC2 Transit Gateway
- id str
- EC2 Transit Gateway Route Table identifier
- Mapping[str, str]
- Key-value tags for the EC2 Transit Gateway Route Table
- transit_gateway_ strid 
- EC2 Transit Gateway identifier
- filters
Sequence[GetRoute Table Filter] 
- arn String
- EC2 Transit Gateway Route Table ARN.
- defaultAssociation BooleanRoute Table 
- Boolean whether this is the default association route table for the EC2 Transit Gateway
- defaultPropagation BooleanRoute Table 
- Boolean whether this is the default propagation route table for the EC2 Transit Gateway
- id String
- EC2 Transit Gateway Route Table identifier
- Map<String>
- Key-value tags for the EC2 Transit Gateway Route Table
- transitGateway StringId 
- EC2 Transit Gateway identifier
- filters List<Property Map>
Supporting Types
GetRouteTableFilter   
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.