Skip to content

Commit 6b765ba

Browse files
authored
feat: add enable_public_s3_endpoint variable for S3 VPC Endpoint for public subnets (#502)
1 parent 5c60272 commit 6b765ba

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
442442
| enable\_monitoring\_endpoint | Should be true if you want to provision a CloudWatch Monitoring endpoint to the VPC | `bool` | `false` | no |
443443
| enable\_nat\_gateway | Should be true if you want to provision NAT Gateways for each of your private networks | `bool` | `false` | no |
444444
| enable\_public\_redshift | Controls if redshift should have public routing table | `bool` | `false` | no |
445+
| enable\_public\_s3\_endpoint | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |
445446
| enable\_qldb\_session\_endpoint | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |
446447
| enable\_rds\_endpoint | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |
447448
| enable\_rekognition\_endpoint | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,12 @@ variable "external_nat_ips" {
304304
default = []
305305
}
306306

307+
variable "enable_public_s3_endpoint" {
308+
description = "Whether to enable S3 VPC Endpoint for public subnets"
309+
default = true
310+
type = bool
311+
}
312+
307313
variable "enable_dynamodb_endpoint" {
308314
description = "Should be true if you want to provision a DynamoDB endpoint to the VPC"
309315
type = bool

vpc-endpoints.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ resource "aws_vpc_endpoint_route_table_association" "intra_s3" {
3030
}
3131

3232
resource "aws_vpc_endpoint_route_table_association" "public_s3" {
33-
count = var.create_vpc && var.enable_s3_endpoint && length(var.public_subnets) > 0 ? 1 : 0
33+
count = var.create_vpc && var.enable_s3_endpoint && var.enable_public_s3_endpoint && length(var.public_subnets) > 0 ? 1 : 0
3434

3535
vpc_endpoint_id = aws_vpc_endpoint.s3[0].id
3636
route_table_id = aws_route_table.public[0].id

0 commit comments

Comments
 (0)