Commit b4aa52c5 authored by bmihaescu's avatar bmihaescu Committed by Anton Babenko

Redshift public subnets (#222)

parent 9b859ff5
...@@ -170,7 +170,11 @@ Sometimes it is handy to have public access to RDS instances (it is not recommen ...@@ -170,7 +170,11 @@ Sometimes it is handy to have public access to RDS instances (it is not recommen
Sometimes it is handy to have public access to Redshift clusters (for example if you need to access it by Kinesis - VPC endpoint for Kinesis is not yet supported by Redshift) by specifying these arguments: Sometimes it is handy to have public access to Redshift clusters (for example if you need to access it by Kinesis - VPC endpoint for Kinesis is not yet supported by Redshift) by specifying these arguments:
```hcl ```hcl
<<<<<<< HEAD
enable_public_redshift = true # <= Default it will be placed into private subnet route table enable_public_redshift = true # <= Default it will be placed into private subnet route table
=======
enable_public_redshift = true # <= By default Redshift subnets will be associated with the private route table
>>>>>>> Redshift public subnets (#222)
``` ```
## Terraform version ## Terraform version
...@@ -247,6 +251,7 @@ Terraform version 0.10.3 or newer is required for this module to work. ...@@ -247,6 +251,7 @@ Terraform version 0.10.3 or newer is required for this module to work.
| enable\_ecr\_api\_endpoint | Should be true if you want to provision an ecr api endpoint to the VPC | string | `"false"` | no | | enable\_ecr\_api\_endpoint | Should be true if you want to provision an ecr api endpoint to the VPC | string | `"false"` | no |
| enable\_ecr\_dkr\_endpoint | Should be true if you want to provision an ecr dkr endpoint to the VPC | string | `"false"` | no | | enable\_ecr\_dkr\_endpoint | Should be true if you want to provision an ecr dkr endpoint to the VPC | string | `"false"` | no |
| enable\_nat\_gateway | Should be true if you want to provision NAT Gateways for each of your private networks | string | `"false"` | no | | enable\_nat\_gateway | Should be true if you want to provision NAT Gateways for each of your private networks | string | `"false"` | no |
| enable\_public\_redshift | Controls if redshift should have public routing table | string | `"false"` | no |
| enable\_s3\_endpoint | Should be true if you want to provision an S3 endpoint to the VPC | string | `"false"` | no | | enable\_s3\_endpoint | Should be true if you want to provision an S3 endpoint to the VPC | string | `"false"` | no |
| enable\_ssm\_endpoint | Should be true if you want to provision an SSM endpoint to the VPC | string | `"false"` | no | | enable\_ssm\_endpoint | Should be true if you want to provision an SSM endpoint to the VPC | string | `"false"` | no |
| enable\_ssmmessages\_endpoint | Should be true if you want to provision a SSMMESSAGES endpoint to the VPC | string | `"false"` | no | | enable\_ssmmessages\_endpoint | Should be true if you want to provision a SSMMESSAGES endpoint to the VPC | string | `"false"` | no |
......
...@@ -569,14 +569,22 @@ resource "aws_route_table_association" "database" { ...@@ -569,14 +569,22 @@ resource "aws_route_table_association" "database" {
} }
resource "aws_route_table_association" "redshift" { resource "aws_route_table_association" "redshift" {
<<<<<<< HEAD
count = "${var.enable_public_redshift == false && var.create_vpc && length(var.redshift_subnets) > 0 ? length(var.redshift_subnets) : 0}" count = "${var.enable_public_redshift == false && var.create_vpc && length(var.redshift_subnets) > 0 ? length(var.redshift_subnets) : 0}"
=======
count = "${var.create_vpc && length(var.redshift_subnets) > 0 && !var.enable_public_redshift ? length(var.redshift_subnets) : 0}"
>>>>>>> Redshift public subnets (#222)
subnet_id = "${element(aws_subnet.redshift.*.id, count.index)}" subnet_id = "${element(aws_subnet.redshift.*.id, count.index)}"
route_table_id = "${element(coalescelist(aws_route_table.redshift.*.id, aws_route_table.private.*.id), (var.single_nat_gateway || var.create_redshift_subnet_route_table ? 0 : count.index))}" route_table_id = "${element(coalescelist(aws_route_table.redshift.*.id, aws_route_table.private.*.id), (var.single_nat_gateway || var.create_redshift_subnet_route_table ? 0 : count.index))}"
} }
resource "aws_route_table_association" "redshift_public" { resource "aws_route_table_association" "redshift_public" {
<<<<<<< HEAD
count = "${var.enable_public_redshift && var.create_vpc && length(var.redshift_subnets) > 0 ? length(var.redshift_subnets) : 0}" count = "${var.enable_public_redshift && var.create_vpc && length(var.redshift_subnets) > 0 ? length(var.redshift_subnets) : 0}"
=======
count = "${var.create_vpc && length(var.redshift_subnets) > 0 && var.enable_public_redshift ? length(var.redshift_subnets) : 0}"
>>>>>>> Redshift public subnets (#222)
subnet_id = "${element(aws_subnet.redshift.*.id, count.index)}" subnet_id = "${element(aws_subnet.redshift.*.id, count.index)}"
route_table_id = "${element(coalescelist(aws_route_table.redshift.*.id, aws_route_table.public.*.id), (var.single_nat_gateway || var.create_redshift_subnet_route_table ? 0 : count.index))}" route_table_id = "${element(coalescelist(aws_route_table.redshift.*.id, aws_route_table.public.*.id), (var.single_nat_gateway || var.create_redshift_subnet_route_table ? 0 : count.index))}"
......
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