Associates a gateway with a route table. The gateway and route table must be in the same VPC. This association causes the incoming traffic to the gateway to be routed according to the routes in the route table.
Associate an internet gateway with a route table.
resource "awscc_ec2_gateway_route_table_association" "igw" {
gateway_id = awscc_ec2_internet_gateway.igw.id
route_table_id = awscc_ec2_route_table.internet.id
}
resource "awscc_ec2_vpc_gateway_attachment" "igw" {
internet_gateway_id = awscc_ec2_internet_gateway.igw.id
vpc_id = awscc_ec2_vpc.vpc.id
}
resource "awscc_ec2_internet_gateway" "igw" {
tags = [{
key = "Managed By"
value = "AWSCC"
}]
}
resource "awscc_ec2_route_table" "internet" {
vpc_id = awscc_ec2_vpc.vpc.id
tags = [{
key = "Managed By"
value = "AWSCC"
}]
}
resource "awscc_ec2_vpc" "vpc" {
cidr_block = "10.0.0.0/16"
tags = [{
key = "Managed By"
value = "AWSCC"
}]
}
Associate a virtual private gateway with a route table.
resource "awscc_ec2_gateway_route_table_association" "vpn" {
gateway_id = awscc_ec2_vpn_gateway.vpn.id
route_table_id = awscc_ec2_route_table.vpn.id
}
resource "awscc_ec2_vpc_gateway_attachment" "vpn" {
vpn_gateway_id = awscc_ec2_vpn_gateway.vpn.id
vpc_id = awscc_ec2_vpc.vpc.id
}
resource "awscc_ec2_vpn_gateway" "vpn" {
type = "ipsec.1"
tags = [
{
key = "Modified By"
value = "AWSCC"
}
]
}
resource "awscc_ec2_route_table" "vpn" {
vpc_id = awscc_ec2_vpc.vpc.id
tags = [{
key = "Managed By"
value = "AWSCC"
}]
}
resource "awscc_ec2_vpc" "vpc" {
cidr_block = "10.0.0.0/16"
tags = [{
key = "Managed By"
value = "AWSCC"
}]
}
gateway_id
(String) The ID of the gateway.route_table_id
(String) The ID of the route table.association_id
(String) The route table association ID.id
(String) Uniquely identifies the resource.Import is supported using the following syntax:
$ terraform import awscc_ec2_gateway_route_table_association.example <resource ID>