diff --git a/modules/vpc/README.md b/modules/vpc/README.md index 1cd4ffc..9c39d1a 100644 --- a/modules/vpc/README.md +++ b/modules/vpc/README.md @@ -72,6 +72,7 @@ No modules. |------|-------------|------|---------|:--------:| | [availability\_zones](#input\_availability\_zones) | The availability zones to provision. If specified will ignore num\_azs | `list(string)` | `[]` | no | | [disable\_nat\_gateway](#input\_disable\_nat\_gateway) | If set to true, will not create NAT Gateway and EC2 Nodes should put in public subnets. This could be useful when wanna save costs from nat gateway. | `bool` | `false` | no | +| [enable\_s3\_gateway\_endpoint](#input\_enable\_s3\_gateway\_endpoint) | If set to true, will create S3 VPC Endpoint. This could be useful when wanna save costs from NAT Gateway. | `bool` | `false` | no | | [num\_azs](#input\_num\_azs) | The number of availability zones to provision | `number` | `2` | no | | [private\_subnet\_newbits](#input\_private\_subnet\_newbits) | The number of bits to added to the VPC CIDR prefix. For instance, if your VPC CIDR is a /16 and you set this number to 4, the subnets will be /20s. | `number` | `4` | no | | [private\_subnet\_start](#input\_private\_subnet\_start) | The starting octet for the private subnet CIDR blocks generated by this module. | `number` | `0` | no | diff --git a/modules/vpc/main.tf b/modules/vpc/main.tf index cbfb70e..8a1ccef 100644 --- a/modules/vpc/main.tf +++ b/modules/vpc/main.tf @@ -145,7 +145,7 @@ resource "aws_route_table_association" "private_assoc" { } resource "aws_vpc_endpoint" "s3_gateway_endpoint" { - count = var.disable_nat_gateway ? 0 : 1 + count = var.disable_nat_gateway || !var.enable_s3_gateway_endpoint ? 0 : 1 vpc_id = aws_vpc.vpc.id service_name = format("com.amazonaws.%s.s3", var.region) diff --git a/modules/vpc/variables.tf b/modules/vpc/variables.tf index d362c5d..5142dd3 100644 --- a/modules/vpc/variables.tf +++ b/modules/vpc/variables.tf @@ -82,3 +82,9 @@ variable "disable_nat_gateway" { default = false description = "If set to true, will not create NAT Gateway and EC2 Nodes should put in public subnets. This could be useful when wanna save costs from nat gateway." } + +variable "enable_s3_gateway_endpoint" { + type = bool + default = false + description = "If set to true, will create S3 VPC Endpoint. This could be useful when wanna save costs from NAT Gateway." +} \ No newline at end of file