1. Packages
  2. AWS
  3. API Docs
  4. ec2transitgateway
  5. getRouteTable
AWS v6.76.0 published on Tuesday, Apr 8, 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"],
        },
    ],
});
Copy
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"],
    },
])
Copy
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
	})
}
Copy
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",
                },
            },
        },
    });

});
Copy
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());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:ec2transitgateway:getRouteTable
      arguments:
        filters:
          - name: default-association-route-table
            values:
              - 'true'
          - name: transit-gateway-id
            values:
              - tgw-12345678
Copy

By Identifier

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = aws.ec2transitgateway.getRouteTable({
    id: "tgw-rtb-12345678",
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.ec2transitgateway.get_route_table(id="tgw-rtb-12345678")
Copy
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
	})
}
Copy
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",
    });

});
Copy
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());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:ec2transitgateway:getRouteTable
      arguments:
        id: tgw-rtb-12345678
Copy

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>
Copy
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]
Copy
func LookupRouteTable(ctx *Context, args *LookupRouteTableArgs, opts ...InvokeOption) (*LookupRouteTableResult, error)
func LookupRouteTableOutput(ctx *Context, args *LookupRouteTableOutputArgs, opts ...InvokeOption) LookupRouteTableResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetRouteTableResult> getRouteTable(GetRouteTableArgs args, InvokeOptions options)
public static Output<GetRouteTableResult> getRouteTable(GetRouteTableArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:ec2transitgateway/getRouteTable:getRouteTable
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Filters List<GetRouteTableFilter>
One or more configuration blocks containing name-values filters. Detailed below.
Id string
Identifier of the EC2 Transit Gateway Route Table.
Tags Dictionary<string, string>
Key-value tags for the EC2 Transit Gateway Route Table
Filters []GetRouteTableFilter
One or more configuration blocks containing name-values filters. Detailed below.
Id string
Identifier of the EC2 Transit Gateway Route Table.
Tags map[string]string
Key-value tags for the EC2 Transit Gateway Route Table
filters List<GetRouteTableFilter>
One or more configuration blocks containing name-values filters. Detailed below.
id String
Identifier of the EC2 Transit Gateway Route Table.
tags Map<String,String>
Key-value tags for the EC2 Transit Gateway Route Table
filters GetRouteTableFilter[]
One or more configuration blocks containing name-values filters. Detailed below.
id string
Identifier of the EC2 Transit Gateway Route Table.
tags {[key: string]: string}
Key-value tags for the EC2 Transit Gateway Route Table
filters Sequence[GetRouteTableFilter]
One or more configuration blocks containing name-values filters. Detailed below.
id str
Identifier of the EC2 Transit Gateway Route Table.
tags 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.
tags 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.
DefaultAssociationRouteTable bool
Boolean whether this is the default association route table for the EC2 Transit Gateway
DefaultPropagationRouteTable bool
Boolean whether this is the default propagation route table for the EC2 Transit Gateway
Id string
EC2 Transit Gateway Route Table identifier
Tags Dictionary<string, string>
Key-value tags for the EC2 Transit Gateway Route Table
TransitGatewayId string
EC2 Transit Gateway identifier
Filters List<GetRouteTableFilter>
Arn string
EC2 Transit Gateway Route Table ARN.
DefaultAssociationRouteTable bool
Boolean whether this is the default association route table for the EC2 Transit Gateway
DefaultPropagationRouteTable bool
Boolean whether this is the default propagation route table for the EC2 Transit Gateway
Id string
EC2 Transit Gateway Route Table identifier
Tags map[string]string
Key-value tags for the EC2 Transit Gateway Route Table
TransitGatewayId string
EC2 Transit Gateway identifier
Filters []GetRouteTableFilter
arn String
EC2 Transit Gateway Route Table ARN.
defaultAssociationRouteTable Boolean
Boolean whether this is the default association route table for the EC2 Transit Gateway
defaultPropagationRouteTable Boolean
Boolean whether this is the default propagation route table for the EC2 Transit Gateway
id String
EC2 Transit Gateway Route Table identifier
tags Map<String,String>
Key-value tags for the EC2 Transit Gateway Route Table
transitGatewayId String
EC2 Transit Gateway identifier
filters List<GetRouteTableFilter>
arn string
EC2 Transit Gateway Route Table ARN.
defaultAssociationRouteTable boolean
Boolean whether this is the default association route table for the EC2 Transit Gateway
defaultPropagationRouteTable boolean
Boolean whether this is the default propagation route table for the EC2 Transit Gateway
id string
EC2 Transit Gateway Route Table identifier
tags {[key: string]: string}
Key-value tags for the EC2 Transit Gateway Route Table
transitGatewayId string
EC2 Transit Gateway identifier
filters GetRouteTableFilter[]
arn str
EC2 Transit Gateway Route Table ARN.
default_association_route_table bool
Boolean whether this is the default association route table for the EC2 Transit Gateway
default_propagation_route_table bool
Boolean whether this is the default propagation route table for the EC2 Transit Gateway
id str
EC2 Transit Gateway Route Table identifier
tags Mapping[str, str]
Key-value tags for the EC2 Transit Gateway Route Table
transit_gateway_id str
EC2 Transit Gateway identifier
filters Sequence[GetRouteTableFilter]
arn String
EC2 Transit Gateway Route Table ARN.
defaultAssociationRouteTable Boolean
Boolean whether this is the default association route table for the EC2 Transit Gateway
defaultPropagationRouteTable Boolean
Boolean whether this is the default propagation route table for the EC2 Transit Gateway
id String
EC2 Transit Gateway Route Table identifier
tags Map<String>
Key-value tags for the EC2 Transit Gateway Route Table
transitGatewayId String
EC2 Transit Gateway identifier
filters List<Property Map>

Supporting Types

GetRouteTableFilter

Name This property is required. string
Name of the filter.
Values This property is required. List<string>
List of one or more values for the filter.
Name This property is required. string
Name of the filter.
Values This property is required. []string
List of one or more values for the filter.
name This property is required. String
Name of the filter.
values This property is required. List<String>
List of one or more values for the filter.
name This property is required. string
Name of the filter.
values This property is required. string[]
List of one or more values for the filter.
name This property is required. str
Name of the filter.
values This property is required. Sequence[str]
List of one or more values for the filter.
name This property is required. String
Name of the filter.
values This property is required. List<String>
List of one or more values for the filter.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.