Skip to content

Commit 6e77ad7

Browse files
committed
Update defaults to match AWS
Default to ACL's disabled and object ownership set to BucketOwnerEnforced
1 parent d95baca commit 6e77ad7

File tree

5 files changed

+10
-15
lines changed

5 files changed

+10
-15
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ It will not do s3 origin, which is in another module.
77

88
```HCL
99
module "s3_basic" {
10-
source = "git@github.com:rackspace-infrastructure-automation/aws-terraform-s3//?ref=v0.12.16"
10+
source = "git@github.com:rackspace-infrastructure-automation/aws-terraform-s3//?ref=v0.12.17"
1111
1212
bucket_logging = false
1313
environment = "Development"
@@ -92,7 +92,7 @@ No Modules.
9292
| block\_public\_access\_restrict\_bucket | Related to block\_public\_access. Only the bucket owner and AWS Services can access this buckets if it has a public policy. | `bool` | `true` | no |
9393
| bucket\_key\_enabled | Whether or not to use Amazon S3 Bucket Keys for SSE-KMS. | `bool` | `false` | no |
9494
| bucket\_logging | Enable bucket logging. Will store logs in another existing bucket. You must give the log-delivery group WRITE and READ\_ACP permissions to the target bucket. i.e. true \| false | `bool` | `false` | no |
95-
| control\_object\_ownership | Whether to manage S3 Bucket Ownership Controls on this bucket. | `bool` | `false` | no |
95+
| control\_object\_ownership | Whether to manage S3 Bucket Ownership Controls on this bucket. | `bool` | `true` | no |
9696
| cors | Enable CORS Rules. Rules must be defined in the variable cors\_rules | `bool` | `false` | no |
9797
| cors\_rule | List of maps containing rules for Cross-Origin Resource Sharing. | `any` | `[]` | no |
9898
| enable\_bucket\_metrics | Enable bucket metrics | `bool` | `false` | no |
@@ -116,7 +116,7 @@ No Modules.
116116
| object\_lock\_retention\_days | The retention of the object lock in days. Either days or years must be specified, but not both. | `number` | `null` | no |
117117
| object\_lock\_retention\_years | The retention of the object lock in years. Either days or years must be specified, but not both. | `number` | `null` | no |
118118
| object\_lock\_token | A token to allow Object Lock to be enabled for an existing bucket. You must contact AWS support for the bucket's 'Object Lock token'. The token is generated in the back-end when versioning is enabled on a bucket. | `string` | `null` | no |
119-
| object\_ownership | Object ownership. Valid values: BucketOwnerEnforced, BucketOwnerPreferred or ObjectWriter. 'BucketOwnerEnforced': ACLs are disabled, and the bucket owner automatically owns and has full control over every object in the bucket. 'BucketOwnerPreferred': Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL. 'ObjectWriter': The uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL. | `string` | `"ObjectWriter"` | no |
119+
| object\_ownership | Object ownership. Valid values: BucketOwnerEnforced, BucketOwnerPreferred or ObjectWriter. 'BucketOwnerEnforced': ACLs are disabled, and the bucket owner automatically owns and has full control over every object in the bucket. 'BucketOwnerPreferred': Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL. 'ObjectWriter': The uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL. | `string` | `"BucketOwnerEnforced"` | no |
120120
| owner | Bucket owner's display name and ID. Conflicts with `acl` | `map(string)` | `{}` | no |
121121
| sse\_algorithm | The server-side encryption algorithm to use. Valid values are AES256, aws:kms, and none | `string` | `"AES256"` | no |
122122
| tags | A map of tags to be applied to the Bucket. i.e {Environment='Development'} | `map(string)` | `{}` | no |

examples/s3.tf

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ resource "random_string" "s3_rstring" {
2121
}
2222

2323
module "s3_basic" {
24-
source = "git@github.com:rackspace-infrastructure-automation/aws-terraform-s3//?ref=v0.12.16"
24+
source = "git@github.com:rackspace-infrastructure-automation/aws-terraform-s3//?ref=v0.12.17"
2525

2626
bucket_logging = false
27-
bucket_acl = "private"
2827
environment = "Development"
2928
name = "${random_string.s3_rstring.result}-example-s3-bucket"
3029
versioning = true
@@ -47,9 +46,8 @@ module "s3_basic" {
4746
module "s3_website_with_cors" {
4847
# Websites and CORS have undergone a significant refactor since v0.12.7 due to features that added to their complexity.
4948
# Follow this example if you are using v0.12.10+
50-
source = "git@github.com:rackspace-infrastructure-automation/aws-terraform-s3//?ref=v0.12.16"
49+
source = "git@github.com:rackspace-infrastructure-automation/aws-terraform-s3//?ref=v0.12.17"
5150

52-
bucket_acl = "private"
5351
bucket_logging = false
5452
environment = "Development"
5553
name = "${random_string.s3_rstring.result}-example-s3-bucket"
@@ -102,9 +100,8 @@ module "s3_website_with_cors" {
102100
}
103101

104102
module "s3_object_lock" {
105-
source = "git@github.com:rackspace-infrastructure-automation/aws-terraform-s3//?ref=v0.12.16"
103+
source = "git@github.com:rackspace-infrastructure-automation/aws-terraform-s3//?ref=v0.12.17"
106104

107-
bucket_acl = "private"
108105
bucket_logging = false
109106
environment = "Development"
110107
name = "${random_string.s3_rstring.result}-example-s3-bucket"
@@ -122,9 +119,8 @@ module "s3_object_lock" {
122119
module "s3_with_lifecycle" {
123120
# Lifecycle has undergone a significant refactor since v0.12.7 due to features that added to their complexity.
124121
# Follow this example if you are using v0.12.10+
125-
source = "git@github.com:rackspace-infrastructure-automation/aws-terraform-s3//?ref=v0.12.16"
122+
source = "git@github.com:rackspace-infrastructure-automation/aws-terraform-s3//?ref=v0.12.17"
126123

127-
bucket_acl = "private"
128124
bucket_logging = false
129125
environment = "Development"
130126
name = "${random_string.s3_rstring.result}-example-s3-bucket"

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* ```HCL
1010
* module "s3_basic" {
11-
* source = "git@github.com:rackspace-infrastructure-automation/aws-terraform-s3//?ref=v0.12.16"
11+
* source = "git@github.com:rackspace-infrastructure-automation/aws-terraform-s3//?ref=v0.12.17"
1212
*
1313
* bucket_logging = false
1414
* environment = "Development"

tests/test2/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ module "s3" {
2828
source = "../../module"
2929

3030
control_object_ownership = true
31-
acl = "private"
3231
bucket_logging = false
3332
environment = "Development"
3433
name = "${random_string.s3_rstring.result}-example-s3-bucket"

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ variable "grant" {
222222
variable "control_object_ownership" {
223223
description = "Whether to manage S3 Bucket Ownership Controls on this bucket."
224224
type = bool
225-
default = false
225+
default = true
226226
}
227227

228228
variable "object_ownership" {
229229
description = "Object ownership. Valid values: BucketOwnerEnforced, BucketOwnerPreferred or ObjectWriter. 'BucketOwnerEnforced': ACLs are disabled, and the bucket owner automatically owns and has full control over every object in the bucket. 'BucketOwnerPreferred': Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL. 'ObjectWriter': The uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL."
230230
type = string
231-
default = "ObjectWriter"
231+
default = "BucketOwnerEnforced"
232232
}

0 commit comments

Comments
 (0)