GetRouteTable
aws.ec2.RouteTable 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.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var config = new Config();
var subnetId = config.RequireObject<dynamic>("subnetId");
var selected = Output.Create(Aws.Ec2.GetRouteTable.InvokeAsync(new Aws.Ec2.GetRouteTableArgs
{
SubnetId = subnetId,
}));
var route = new Aws.Ec2.Route("route", new Aws.Ec2.RouteArgs
{
DestinationCidrBlock = "10.0.1.0/22",
RouteTableId = selected.Apply(selected => selected.Id),
VpcPeeringConnectionId = "pcx-45ff3dc1",
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
opt0 := subnetId
selected, err := ec2.LookupRouteTable(ctx, &ec2.LookupRouteTableArgs{
SubnetId: &opt0,
}, nil)
if err != nil {
return err
}
_, err = ec2.NewRoute(ctx, "route", &ec2.RouteArgs{
DestinationCidrBlock: pulumi.String("10.0.1.0/22"),
RouteTableId: pulumi.String(selected.Id),
VpcPeeringConnectionId: pulumi.String("pcx-45ff3dc1"),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
config = pulumi.Config()
subnet_id = config.require_object("subnetId")
selected = aws.ec2.get_route_table(subnet_id=subnet_id)
route = aws.ec2.Route("route",
destination_cidr_block="10.0.1.0/22",
route_table_id=selected.id,
vpc_peering_connection_id="pcx-45ff3dc1")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const config = new pulumi.Config();
const subnetId = config.require("subnetId");
const selected = pulumi.output(aws.ec2.getRouteTable({
subnetId: subnetId,
}, { async: true }));
const route = new aws.ec2.Route("route", {
destinationCidrBlock: "10.0.1.0/22",
routeTableId: selected.id,
vpcPeeringConnectionId: "pcx-45ff3dc1",
});Using GetRouteTable
function getRouteTable(args: GetRouteTableArgs, opts?: InvokeOptions): Promise<GetRouteTableResult>function get_route_table(filters=None, gateway_id=None, route_table_id=None, subnet_id=None, tags=None, vpc_id=None, opts=None)func LookupRouteTable(ctx *Context, args *LookupRouteTableArgs, opts ...InvokeOption) (*LookupRouteTableResult, error)Note: This function is named
LookupRouteTablein the Go SDK.
public static class GetRouteTable {
public static Task<GetRouteTableResult> InvokeAsync(GetRouteTableArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Filters
List<Get
Route Table Filter Args> Custom filter block as described below.
- Gateway
Id string The id of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
- Route
Table stringId The id of the specific Route Table to retrieve.
- Subnet
Id string The id of a Subnet which is connected to the Route Table (not exported if not passed as a parameter).
- Dictionary<string, string>
A map of tags, each pair of which must exactly match a pair on the desired Route Table.
- Vpc
Id string The id of the VPC that the desired Route Table belongs to.
- Filters
[]Get
Route Table Filter Custom filter block as described below.
- Gateway
Id string The id of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
- Route
Table stringId The id of the specific Route Table to retrieve.
- Subnet
Id string The id of a Subnet which is connected to the Route Table (not exported if not passed as a parameter).
- map[string]string
A map of tags, each pair of which must exactly match a pair on the desired Route Table.
- Vpc
Id string The id of the VPC that the desired Route Table belongs to.
- filters
Get
Route Table Filter[] Custom filter block as described below.
- gateway
Id string The id of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
- route
Table stringId The id of the specific Route Table to retrieve.
- subnet
Id string The id of a Subnet which is connected to the Route Table (not exported if not passed as a parameter).
- {[key: string]: string}
A map of tags, each pair of which must exactly match a pair on the desired Route Table.
- vpc
Id string The id of the VPC that the desired Route Table belongs to.
- filters
List[Get
Route Table Filter] Custom filter block as described below.
- gateway_
id str The id of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
- route_
table_ strid The id of the specific Route Table to retrieve.
- subnet_
id str The id of a Subnet which is connected to the Route Table (not exported if not passed as a parameter).
- Dict[str, str]
A map of tags, each pair of which must exactly match a pair on the desired Route Table.
- vpc_
id str The id of the VPC that the desired Route Table belongs to.
GetRouteTable Result
The following output properties are available:
- Associations
List<Get
Route Table Association> - Gateway
Id string The Gateway ID. Only set when associated with an Internet Gateway or Virtual Private Gateway.
- Id string
The provider-assigned unique ID for this managed resource.
- Owner
Id string The ID of the AWS account that owns the route table
- Route
Table stringId The Route Table ID.
- Routes
List<Get
Route Table Route> - Subnet
Id string The Subnet ID. Only set when associated with a Subnet.
- Dictionary<string, string>
- Vpc
Id string - Filters
List<Get
Route Table Filter>
- Associations
[]Get
Route Table Association Type - Gateway
Id string The Gateway ID. Only set when associated with an Internet Gateway or Virtual Private Gateway.
- Id string
The provider-assigned unique ID for this managed resource.
- Owner
Id string The ID of the AWS account that owns the route table
- Route
Table stringId The Route Table ID.
- Routes
[]Get
Route Table Route - Subnet
Id string The Subnet ID. Only set when associated with a Subnet.
- map[string]string
- Vpc
Id string - Filters
[]Get
Route Table Filter
- associations
Get
Route Table Association[] - gateway
Id string The Gateway ID. Only set when associated with an Internet Gateway or Virtual Private Gateway.
- id string
The provider-assigned unique ID for this managed resource.
- owner
Id string The ID of the AWS account that owns the route table
- route
Table stringId The Route Table ID.
- routes
Get
Route Table Route[] - subnet
Id string The Subnet ID. Only set when associated with a Subnet.
- {[key: string]: string}
- vpc
Id string - filters
Get
Route Table Filter[]
- associations
List[Get
Route Table Association] - gateway_
id str The Gateway ID. Only set when associated with an Internet Gateway or Virtual Private Gateway.
- id str
The provider-assigned unique ID for this managed resource.
- owner_
id str The ID of the AWS account that owns the route table
- route_
table_ strid The Route Table ID.
- routes
List[Get
Route Table Route] - subnet_
id str The Subnet ID. Only set when associated with a Subnet.
- Dict[str, str]
- vpc_
id str - filters
List[Get
Route Table Filter]
Supporting Types
GetRouteTableAssociation
See the output API doc for this type.
See the output API doc for this type.
See the output API doc for this type.
- Gateway
Id string The id of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
- Main bool
If the Association due to the Main Route Table.
- Route
Table stringAssociation Id The Association ID.
- Route
Table stringId The id of the specific Route Table to retrieve.
- Subnet
Id string The id of a Subnet which is connected to the Route Table (not exported if not passed as a parameter).
- Gateway
Id string The id of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
- Main bool
If the Association due to the Main Route Table.
- Route
Table stringAssociation Id The Association ID.
- Route
Table stringId The id of the specific Route Table to retrieve.
- Subnet
Id string The id of a Subnet which is connected to the Route Table (not exported if not passed as a parameter).
- gateway
Id string The id of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
- main boolean
If the Association due to the Main Route Table.
- route
Table stringAssociation Id The Association ID.
- route
Table stringId The id of the specific Route Table to retrieve.
- subnet
Id string The id of a Subnet which is connected to the Route Table (not exported if not passed as a parameter).
- gateway_
id str The id of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
- main bool
If the Association due to the Main Route Table.
- route
Table strAssociation Id The Association ID.
- route_
table_ strid The id of the specific Route Table to retrieve.
- subnet_
id str The id of a Subnet which is connected to the Route Table (not exported if not passed as a parameter).
GetRouteTableFilter
- Name string
The name of the field to filter by, as defined by the underlying AWS API.
- Values List<string>
Set of values that are accepted for the given field. A Route Table will be selected if any one of the given values matches.
- Name string
The name of the field to filter by, as defined by the underlying AWS API.
- Values []string
Set of values that are accepted for the given field. A Route Table will be selected if any one of the given values matches.
- name string
The name of the field to filter by, as defined by the underlying AWS API.
- values string[]
Set of values that are accepted for the given field. A Route Table will be selected if any one of the given values matches.
- name str
The name of the field to filter by, as defined by the underlying AWS API.
- values List[str]
Set of values that are accepted for the given field. A Route Table will be selected if any one of the given values matches.
GetRouteTableRoute
See the output API doc for this type.
See the output API doc for this type.
See the output API doc for this type.
- Cidr
Block string The CIDR block of the route.
- Egress
Only stringGateway Id The ID of the Egress Only Internet Gateway.
- Gateway
Id string The id of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
- Instance
Id string The EC2 instance ID.
- Ipv6Cidr
Block string The IPv6 CIDR block of the route.
- Nat
Gateway stringId The NAT Gateway ID.
- Network
Interface stringId The ID of the elastic network interface (eni) to use.
- Transit
Gateway stringId The EC2 Transit Gateway ID.
- Vpc
Peering stringConnection Id The VPC Peering ID.
- Cidr
Block string The CIDR block of the route.
- Egress
Only stringGateway Id The ID of the Egress Only Internet Gateway.
- Gateway
Id string The id of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
- Instance
Id string The EC2 instance ID.
- Ipv6Cidr
Block string The IPv6 CIDR block of the route.
- Nat
Gateway stringId The NAT Gateway ID.
- Network
Interface stringId The ID of the elastic network interface (eni) to use.
- Transit
Gateway stringId The EC2 Transit Gateway ID.
- Vpc
Peering stringConnection Id The VPC Peering ID.
- cidr
Block string The CIDR block of the route.
- egress
Only stringGateway Id The ID of the Egress Only Internet Gateway.
- gateway
Id string The id of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
- instance
Id string The EC2 instance ID.
- ipv6Cidr
Block string The IPv6 CIDR block of the route.
- nat
Gateway stringId The NAT Gateway ID.
- network
Interface stringId The ID of the elastic network interface (eni) to use.
- transit
Gateway stringId The EC2 Transit Gateway ID.
- vpc
Peering stringConnection Id The VPC Peering ID.
- cidr_
block str The CIDR block of the route.
- egress_
only_ strgateway_ id The ID of the Egress Only Internet Gateway.
- gateway_
id str The id of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
- instance_
id str The EC2 instance ID.
- ipv6_
cidr_ strblock The IPv6 CIDR block of the route.
- nat_
gateway_ strid The NAT Gateway ID.
- network_
interface_ strid The ID of the elastic network interface (eni) to use.
- transit_
gateway_ strid The EC2 Transit Gateway ID.
- vpc_
peering_ strconnection_ id The VPC Peering ID.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.