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

Create input "create_database_internet_gateway_route" #179

Closed
wants to merge 2 commits into from
Closed
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ Terraform version 0.10.3 or newer is required for this module to work.
| azs | A list of availability zones in the region | string | `<list>` | no |
| cidr | The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden | string | `0.0.0.0/0` | no |
| create_database_subnet_group | Controls if database subnet group should be created | string | `true` | no |
| create_database_internet_gateway_route | Controls if an internet gateway route for public database access should be created | string | `false` | no |
| create_database_subnet_route_table | Controls if separate route table for database should be created | string | `false` | no |
| create_elasticache_subnet_route_table | Controls if separate route table for elasticache should be created | string | `false` | no |
| create_redshift_subnet_route_table | Controls if separate route table for redshift should be created | string | `false` | no |
Expand Down
8 changes: 8 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ resource "aws_route" "public_internet_gateway" {
}
}

resource "aws_route" "database_internet_gateway" {
count = "${aws_internet_gateway.this.count > 0 && var.create_database_subnet_route_table && length(var.database_subnets) > 0 ? 1 : 0}"

route_table_id = "${aws_route_table.database.id}"
destination_cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.this.id}"
}

#################
# Private routes
# There are so many routing tables as the largest amount of subnets of each type (really?)
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ variable "create_database_subnet_group" {
default = true
}

variable "create_database_internet_gateway_route" {
description = "Controls if an internet gateway route for public database access should be created"
default = false
}

variable "azs" {
description = "A list of availability zones in the region"
default = []
Expand Down