File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
customer-managed/aws/terraform Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,12 @@ resource "aws_route_table" "main" {
22 vpc_id = data. aws_vpc . redpanda . id
33}
44
5+ locals {
6+ create_private_subnet_routes = local. create_private_subnets ? true : var. create_private_s3_route
7+ }
8+
59resource "aws_route_table" "private" {
6- count = local. create_private_subnets ? length (var . private_subnet_cidrs ) : 0
10+ count = local. create_private_subnet_routes ? length (local . subnet_ids ) : 0
711 vpc_id = data. aws_vpc . redpanda . id
812
913 tags = merge (
@@ -26,14 +30,14 @@ resource "aws_route_table_association" "public" {
2630}
2731
2832resource "aws_route_table_association" "private" {
29- count = local. create_private_subnets ? length (var . private_subnet_cidrs ) : 0
30- subnet_id = aws_subnet . private [count . index ]. id
33+ count = local. create_private_subnet_routes ? length (aws_route_table . private ) : 0
34+ subnet_id = local . subnet_ids [count . index ]
3135 route_table_id = aws_route_table. private [count . index ]. id
3236}
3337
3438# Routes S3 traffic to the local gateway endpoint
3539resource "aws_vpc_endpoint_route_table_association" "private_s3" {
36- count = local . create_private_subnets ? length (var . private_subnet_cidrs ) : 0
40+ count = length (aws_route_table . private )
3741 vpc_endpoint_id = aws_vpc_endpoint. s3 . id
3842 route_table_id = aws_route_table. private [count . index ]. id
3943}
Original file line number Diff line number Diff line change @@ -184,3 +184,13 @@ variable "enable_redpanda_connect" {
184184 When true grants additional permissions required by Redpanda Connect.
185185 HELP
186186}
187+
188+ variable "create_private_s3_route" {
189+ type = bool
190+ default = false
191+ description = <<- HELP
192+ Applies only when private_subnet_ids is passed. If private subnets are created externally this variable defaults
193+ to skipping creation of a VPC endpoint and route to S3 for private access to S3 buckets. Setting this variable to
194+ true will create the VPC endpoint and route to S3 for private access to S3 buckets for the passed private subnet IDs.
195+ HELP
196+ }
You can’t perform that action at this time.
0 commit comments