Commit 8a293e73 authored by Anton Babenko's avatar Anton Babenko

Added possibility to control creation of elasticache and redshift subnet groups

parent 4e484aa7
...@@ -186,7 +186,9 @@ Terraform version 0.10.3 or newer is required for this module to work. ...@@ -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\_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\_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\_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\_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\_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 | | 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 | | database\_route\_table\_tags | Additional tags for the database route tables | map | `{}` | no |
...@@ -255,7 +257,7 @@ Terraform version 0.10.3 or newer is required for this module to work. ...@@ -255,7 +257,7 @@ Terraform version 0.10.3 or newer is required for this module to work.
| Name | Description | | 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\_route\_table\_ids | List of IDs of database route tables |
| database\_subnet\_group | ID of database subnet group | | database\_subnet\_group | ID of database subnet group |
| database\_subnets | List of IDs of database subnets | | database\_subnets | List of IDs of database subnets |
......
...@@ -230,7 +230,7 @@ resource "aws_subnet" "redshift" { ...@@ -230,7 +230,7 @@ resource "aws_subnet" "redshift" {
} }
resource "aws_redshift_subnet_group" "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)}" name = "${lower(var.name)}"
description = "Redshift subnet group for ${var.name}" description = "Redshift subnet group for ${var.name}"
...@@ -253,7 +253,7 @@ resource "aws_subnet" "elasticache" { ...@@ -253,7 +253,7 @@ resource "aws_subnet" "elasticache" {
} }
resource "aws_elasticache_subnet_group" "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}" name = "${var.name}"
description = "ElastiCache subnet group for ${var.name}" description = "ElastiCache subnet group for ${var.name}"
......
...@@ -279,6 +279,6 @@ output "default_vpc_main_route_table_id" { ...@@ -279,6 +279,6 @@ output "default_vpc_main_route_table_id" {
//} //}
output "azs" { 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}" value = "${var.azs}"
} }
...@@ -81,6 +81,12 @@ variable "elasticache_subnets" { ...@@ -81,6 +81,12 @@ variable "elasticache_subnets" {
default = [] default = []
} }
variable "intra_subnets" {
type = "list"
description = "A list of intra subnets"
default = []
}
variable "create_database_subnet_route_table" { variable "create_database_subnet_route_table" {
description = "Controls if separate route table for database should be created" description = "Controls if separate route table for database should be created"
default = false default = false
...@@ -96,17 +102,21 @@ variable "create_elasticache_subnet_route_table" { ...@@ -96,17 +102,21 @@ variable "create_elasticache_subnet_route_table" {
default = false default = false
} }
variable "intra_subnets" {
type = "list"
description = "A list of intra subnets"
default = []
}
variable "create_database_subnet_group" { variable "create_database_subnet_group" {
description = "Controls if database subnet group should be created" description = "Controls if database subnet group should be created"
default = true 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" { variable "create_database_internet_gateway_route" {
description = "Controls if an internet gateway route for public database access should be created" description = "Controls if an internet gateway route for public database access should be created"
default = false default = false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment