awscc_ec2_gateway_route_table_association (Resource)

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.

Example Usage

Internet Gateway Association

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"
  }]
}

Virtual Private Gateway Association

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"
  }]
}

Schema

Required

Read-Only

Import

Import is supported using the following syntax:

$ terraform import awscc_ec2_gateway_route_table_association.example <resource ID>