Skip to content

Commit beca905

Browse files
revert create_private_s3_route logic (#63)
* Revert "Allow user to create S3 vpc gateway endpoint on pre-existing subnets (#62)" This reverts commit 79af68c. * Add back create_private_s3_route but mark deprecated
1 parent 79af68c commit beca905

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

customer-managed/aws/terraform/routing.tf

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ 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-
95
resource "aws_route_table" "private" {
10-
count = local.create_private_subnet_routes ? length(local.subnet_ids) : 0
6+
count = local.create_private_subnets ? length(var.private_subnet_cidrs) : 0
117
vpc_id = data.aws_vpc.redpanda.id
128

139
tags = merge(
@@ -30,14 +26,14 @@ resource "aws_route_table_association" "public" {
3026
}
3127

3228
resource "aws_route_table_association" "private" {
33-
count = local.create_private_subnet_routes ? length(aws_route_table.private) : 0
34-
subnet_id = local.subnet_ids[count.index]
29+
count = local.create_private_subnets ? length(var.private_subnet_cidrs) : 0
30+
subnet_id = aws_subnet.private[count.index].id
3531
route_table_id = aws_route_table.private[count.index].id
3632
}
3733

3834
# Routes S3 traffic to the local gateway endpoint
3935
resource "aws_vpc_endpoint_route_table_association" "private_s3" {
40-
count = length(aws_route_table.private)
36+
count = local.create_private_subnets ? length(var.private_subnet_cidrs) : 0
4137
vpc_endpoint_id = aws_vpc_endpoint.s3.id
4238
route_table_id = aws_route_table.private[count.index].id
4339
}

customer-managed/aws/terraform/variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,12 @@ variable "enable_redpanda_connect" {
185185
HELP
186186
}
187187

188+
# tflint-ignore: terraform_unused_declarations
188189
variable "create_private_s3_route" {
189190
type = bool
190191
default = false
191192
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.
193+
DEPRECATED: When private subnets are created externally, s3 routes will never be created here and are also expected
194+
to be created externally. This variable will be removed in a future release.
195195
HELP
196196
}

0 commit comments

Comments
 (0)