Skip to content

Commit 89eefd8

Browse files
authored
make the S3 Bucket Public Access Block optional (#48)
1 parent d306358 commit 89eefd8

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ Available targets:
186186
| context | Default context to use for passing state between label invocations | <pre>object({<br> namespace = string<br> environment = string<br> stage = string<br> name = string<br> enabled = bool<br> delimiter = string<br> attributes = list(string)<br> label_order = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> })</pre> | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": "",<br> "enabled": true,<br> "environment": "",<br> "label_order": [],<br> "name": "",<br> "namespace": "",<br> "regex_replace_chars": "",<br> "stage": "",<br> "tags": {}<br>}</pre> | no |
187187
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | `string` | `"-"` | no |
188188
| enable\_point\_in\_time\_recovery | Enable DynamoDB point-in-time recovery | `bool` | `false` | no |
189+
| enable\_public\_access\_block | Enable Bucket Public Access Block | `bool` | `true` | no |
189190
| enable\_server\_side\_encryption | Enable DynamoDB server-side encryption | `bool` | `true` | no |
190191
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | `string` | `""` | no |
191192
| force\_destroy | A boolean that indicates the S3 bucket can be destroyed even if it contains objects. These objects are not recoverable | `bool` | `false` | no |

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
| context | Default context to use for passing state between label invocations | <pre>object({<br> namespace = string<br> environment = string<br> stage = string<br> name = string<br> enabled = bool<br> delimiter = string<br> attributes = list(string)<br> label_order = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> })</pre> | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": "",<br> "enabled": true,<br> "environment": "",<br> "label_order": [],<br> "name": "",<br> "namespace": "",<br> "regex_replace_chars": "",<br> "stage": "",<br> "tags": {}<br>}</pre> | no |
3131
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | `string` | `"-"` | no |
3232
| enable\_point\_in\_time\_recovery | Enable DynamoDB point-in-time recovery | `bool` | `false` | no |
33+
| enable\_public\_access\_block | Enable Bucket Public Access Block | `bool` | `true` | no |
3334
| enable\_server\_side\_encryption | Enable DynamoDB server-side encryption | `bool` | `true` | no |
3435
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | `string` | `""` | no |
3536
| force\_destroy | A boolean that indicates the S3 bucket can be destroyed even if it contains objects. These objects are not recoverable | `bool` | `false` | no |

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ resource "aws_s3_bucket" "default" {
145145
}
146146

147147
resource "aws_s3_bucket_public_access_block" "default" {
148+
count = var.enable_public_access_block ? 1 : 0
148149
bucket = aws_s3_bucket.default.id
149150
block_public_acls = var.block_public_acls
150151
ignore_public_acls = var.ignore_public_acls

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ variable "enable_server_side_encryption" {
138138
default = true
139139
}
140140

141+
variable "enable_public_access_block" {
142+
type = bool
143+
description = "Enable Bucket Public Access Block"
144+
default = true
145+
}
146+
141147
variable "block_public_acls" {
142148
type = bool
143149
description = "Whether Amazon S3 should block public ACLs for this bucket"

0 commit comments

Comments
 (0)