terraform.aws-baseline-infra/modules/storage/s3_bucket_2023/README.md

39 lines
1.1 KiB
Markdown
Raw Normal View History

2023-05-25 08:28:19 +08:00
# s3_bucket_2023 module
This module creates s3 bucket, following new terraform standards.
If lifecycle policy is enabled, provide the expiration days.
Transition days are hard-coded with intelligent-tiering class to simplify administration.
## Example
```hcl
module "bucket1" {
source = "../../../../whk1-bea-sys-ss-prd-codecommit-sharedmodules/Storage/s3_bucket_2023"
bucket_name = var.bucket_name1
bucket_policy_json = jsonencode(
{
"Version" : "2012-10-17",
"Id" : "",
"Statement" : [
{
"Sid" : "Set permissions for objects",
"Effect" : "Allow",
"Principal" : {
"AWS" : "851239346925"
},
"Action" : ["s3:ReplicateObject", "s3:ReplicateDelete"],
"Resource" : "arn:aws:s3:::${var.bucket_name1}/*"
}
]
}
)
enable_encryption = true
encryption_key_arn = var.encryption_key_arn
enable_versioning = false
enable_bucket_logging = false
enable_bucket_lifecycle = true
current_version_expiration_days = 731
noncurrent_version_expiration_days = 731
}
```