Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a route table with separate (rather than inline) routes #654

Merged
merged 1 commit into from
Mar 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Notable changes between versions.
#### AWS

* Fix `worker_node_labels` for setting initial worker node labels on Fedora CoreOS ([#651](https://github.com/poseidon/typhoon/pull/651))
* Allow VPC route table extension via reference ([#654](https://github.com/poseidon/typhoon/pull/654))

#### Google Cloud

Expand Down
22 changes: 12 additions & 10 deletions aws/container-linux/kubernetes/network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,23 @@ resource "aws_internet_gateway" "gateway" {
resource "aws_route_table" "default" {
vpc_id = aws_vpc.network.id

route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.gateway.id
}

route {
ipv6_cidr_block = "::/0"
gateway_id = aws_internet_gateway.gateway.id
}

tags = {
"Name" = var.cluster_name
}
}

resource "aws_route" "egress-ipv4" {
route_table_id = aws_route_table.default.id
destination_cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.gateway.id
}

resource "aws_route" "egress-ipv6" {
route_table_id = aws_route_table.default.id
destination_ipv6_cidr_block = "::/0"
gateway_id = aws_internet_gateway.gateway.id
}

# Subnets (one per availability zone)

resource "aws_subnet" "public" {
Expand Down
22 changes: 12 additions & 10 deletions aws/fedora-coreos/kubernetes/network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,23 @@ resource "aws_internet_gateway" "gateway" {
resource "aws_route_table" "default" {
vpc_id = aws_vpc.network.id

route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.gateway.id
}

route {
ipv6_cidr_block = "::/0"
gateway_id = aws_internet_gateway.gateway.id
}

tags = {
"Name" = var.cluster_name
}
}

resource "aws_route" "egress-ipv4" {
route_table_id = aws_route_table.default.id
destination_cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.gateway.id
}

resource "aws_route" "egress-ipv6" {
route_table_id = aws_route_table.default.id
destination_ipv6_cidr_block = "::/0"
gateway_id = aws_internet_gateway.gateway.id
}

# Subnets (one per availability zone)

resource "aws_subnet" "public" {
Expand Down
17 changes: 17 additions & 0 deletions docs/architecture/aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ resource "aws_security_group_rule" "some-app" {
}
```

## Routes

Add a custom [route](https://www.terraform.io/docs/providers/aws/r/route.html) to the VPC route table.

```tf
data "aws_route_table" "default" {
vpc_id = module.temptest.vpc_id
subnet_id = module.tempest.subnet_ids[0]
}

resource "aws_route" "peering" {
route_table_id = data.aws_route_table.default.id
destination_cidr_block = "192.168.4.0/24"
...
}
```

## IPv6

AWS Network Load Balancers do not support `dualstack`.
Expand Down