Skip to content

Commit 5211726

Browse files
authored
feat(vpc): add enable_s3_gateway_endpoint variable (#168)
<!-- ~ Copyright 2023 StreamNative, Inc. ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <!-- ### Contribution Checklist - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review. - Each pull request should address only one issue, not mix up code from multiple issues. - Each commit in the pull request has a meaningful commit message - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below. **(The sections below can be removed for hotfixes of typos)** --> ### Motivation Add new variable enable_s3_gateway_endpoint ### Modifications - New variable `enable_s3_gateway_endpoint` ### Verifying this change - [x] Make sure that the change passes the CI checks. *(Please pick either of the following options)* This change is a trivial rework / code cleanup without any test coverage. *(or)* This change is already covered by existing tests, such as *(please describe tests)*. *(or)* This change added tests and can be verified as follows: *(example:)* - *Added integration tests for end-to-end deployment with large payloads (10MB)* - *Extended integration test for recovery after broker failure* ### Documentation - [x] `doc` (If this PR contains doc changes) Signed-off-by: Max Xu <[email protected]>
1 parent 8ea10c0 commit 5211726

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

modules/vpc/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ No modules.
7272
|------|-------------|------|---------|:--------:|
7373
| <a name="input_availability_zones"></a> [availability\_zones](#input\_availability\_zones) | The availability zones to provision. If specified will ignore num\_azs | `list(string)` | `[]` | no |
7474
| <a name="input_disable_nat_gateway"></a> [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 |
75+
| <a name="input_enable_s3_gateway_endpoint"></a> [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 |
7576
| <a name="input_num_azs"></a> [num\_azs](#input\_num\_azs) | The number of availability zones to provision | `number` | `2` | no |
7677
| <a name="input_private_subnet_newbits"></a> [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 |
7778
| <a name="input_private_subnet_start"></a> [private\_subnet\_start](#input\_private\_subnet\_start) | The starting octet for the private subnet CIDR blocks generated by this module. | `number` | `0` | no |

modules/vpc/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ resource "aws_route_table_association" "private_assoc" {
145145
}
146146

147147
resource "aws_vpc_endpoint" "s3_gateway_endpoint" {
148-
count = var.disable_nat_gateway ? 0 : 1
148+
count = var.disable_nat_gateway || !var.enable_s3_gateway_endpoint ? 0 : 1
149149

150150
vpc_id = aws_vpc.vpc.id
151151
service_name = format("com.amazonaws.%s.s3", var.region)

modules/vpc/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,9 @@ variable "disable_nat_gateway" {
8282
default = false
8383
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."
8484
}
85+
86+
variable "enable_s3_gateway_endpoint" {
87+
type = bool
88+
default = false
89+
description = "If set to true, will create S3 VPC Endpoint. This could be useful when wanna save costs from NAT Gateway."
90+
}

0 commit comments

Comments
 (0)