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

Added possibility to control creation of elasticache and redshift subnet groups #199

Merged
merged 1 commit into from
Jan 10, 2019
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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ Terraform version 0.10.3 or newer is required for this module to work.
| create\_database\_internet\_gateway\_route | Controls if an internet gateway route for public database access should be created | string | `false` | no |
| create\_database\_subnet\_group | Controls if database subnet group should be created | string | `true` | no |
| create\_database\_subnet\_route\_table | Controls if separate route table for database should be created | string | `false` | no |
| create\_elasticache\_subnet\_group | Controls if elasticache subnet group should be created | string | `true` | no |
| create\_elasticache\_subnet\_route\_table | Controls if separate route table for elasticache should be created | string | `false` | no |
| create\_redshift\_subnet\_group | Controls if redshift subnet group should be created | string | `true` | no |
| create\_redshift\_subnet\_route\_table | Controls if separate route table for redshift should be created | string | `false` | no |
| create\_vpc | Controls if VPC should be created (it affects almost all resources) | string | `true` | no |
| database\_route\_table\_tags | Additional tags for the database route tables | map | `{}` | no |
Expand Down Expand Up @@ -255,7 +257,7 @@ Terraform version 0.10.3 or newer is required for this module to work.

| Name | Description |
|------|-------------|
| azs | A list of availability zones spefified as argument to this module |
| azs | A list of availability zones specified as argument to this module |
| database\_route\_table\_ids | List of IDs of database route tables |
| database\_subnet\_group | ID of database subnet group |
| database\_subnets | List of IDs of database subnets |
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ resource "aws_subnet" "redshift" {
}

resource "aws_redshift_subnet_group" "redshift" {
count = "${var.create_vpc && length(var.redshift_subnets) > 0 ? 1 : 0}"
count = "${var.create_vpc && length(var.redshift_subnets) > 0 && var.create_redshift_subnet_group ? 1 : 0}"

name = "${lower(var.name)}"
description = "Redshift subnet group for ${var.name}"
Expand All @@ -253,7 +253,7 @@ resource "aws_subnet" "elasticache" {
}

resource "aws_elasticache_subnet_group" "elasticache" {
count = "${var.create_vpc && length(var.elasticache_subnets) > 0 ? 1 : 0}"
count = "${var.create_vpc && length(var.elasticache_subnets) > 0 && var.create_elasticache_subnet_group ? 1 : 0}"

name = "${var.name}"
description = "ElastiCache subnet group for ${var.name}"
Expand Down
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,6 @@ output "default_vpc_main_route_table_id" {
//}

output "azs" {
description = "A list of availability zones spefified as argument to this module"
description = "A list of availability zones specified as argument to this module"
value = "${var.azs}"
}
22 changes: 16 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ variable "elasticache_subnets" {
default = []
}

variable "intra_subnets" {
type = "list"
description = "A list of intra subnets"
default = []
}

variable "create_database_subnet_route_table" {
description = "Controls if separate route table for database should be created"
default = false
Expand All @@ -96,17 +102,21 @@ variable "create_elasticache_subnet_route_table" {
default = false
}

variable "intra_subnets" {
type = "list"
description = "A list of intra subnets"
default = []
}

variable "create_database_subnet_group" {
description = "Controls if database subnet group should be created"
default = true
}

variable "create_elasticache_subnet_group" {
description = "Controls if elasticache subnet group should be created"
default = true
}

variable "create_redshift_subnet_group" {
description = "Controls if redshift subnet group should be created"
default = true
}

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