Skip to content

Commit b4aa52c

Browse files
bmihaescuantonbabenko
authored andcommitted
Redshift public subnets (#222)
1 parent 9b859ff commit b4aa52c

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ Sometimes it is handy to have public access to RDS instances (it is not recommen
170170
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:
171171

172172
```hcl
173+
<<<<<<< HEAD
173174
enable_public_redshift = true # <= Default it will be placed into private subnet route table
175+
=======
176+
enable_public_redshift = true # <= By default Redshift subnets will be associated with the private route table
177+
>>>>>>> Redshift public subnets (#222)
174178
```
175179

176180
## Terraform version
@@ -247,6 +251,7 @@ Terraform version 0.10.3 or newer is required for this module to work.
247251
| enable\_ecr\_api\_endpoint | Should be true if you want to provision an ecr api endpoint to the VPC | string | `"false"` | no |
248252
| enable\_ecr\_dkr\_endpoint | Should be true if you want to provision an ecr dkr endpoint to the VPC | string | `"false"` | no |
249253
| enable\_nat\_gateway | Should be true if you want to provision NAT Gateways for each of your private networks | string | `"false"` | no |
254+
| enable\_public\_redshift | Controls if redshift should have public routing table | string | `"false"` | no |
250255
| enable\_s3\_endpoint | Should be true if you want to provision an S3 endpoint to the VPC | string | `"false"` | no |
251256
| enable\_ssm\_endpoint | Should be true if you want to provision an SSM endpoint to the VPC | string | `"false"` | no |
252257
| enable\_ssmmessages\_endpoint | Should be true if you want to provision a SSMMESSAGES endpoint to the VPC | string | `"false"` | no |

main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,14 +569,22 @@ resource "aws_route_table_association" "database" {
569569
}
570570

571571
resource "aws_route_table_association" "redshift" {
572+
<<<<<<< HEAD
572573
count = "${var.enable_public_redshift == false && var.create_vpc && length(var.redshift_subnets) > 0 ? length(var.redshift_subnets) : 0}"
574+
=======
575+
count = "${var.create_vpc && length(var.redshift_subnets) > 0 && !var.enable_public_redshift ? length(var.redshift_subnets) : 0}"
576+
>>>>>>> Redshift public subnets (#222)
573577
574578
subnet_id = "${element(aws_subnet.redshift.*.id, count.index)}"
575579
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))}"
576580
}
577581
578582
resource "aws_route_table_association" "redshift_public" {
583+
<<<<<<< HEAD
579584
count = "${var.enable_public_redshift && var.create_vpc && length(var.redshift_subnets) > 0 ? length(var.redshift_subnets) : 0}"
585+
=======
586+
count = "${var.create_vpc && length(var.redshift_subnets) > 0 && var.enable_public_redshift ? length(var.redshift_subnets) : 0}"
587+
>>>>>>> Redshift public subnets (#222)
580588
581589
subnet_id = "${element(aws_subnet.redshift.*.id, count.index)}"
582590
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))}"

0 commit comments

Comments
 (0)