Skip to content

Commit 0af30b4

Browse files
pre-commit-ci-lite[bot]Shanawaze
authored andcommitted
[pre-commit.ci lite] apply automatic fixes
1 parent 5de0fb5 commit 0af30b4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ No modules.
4141
| <a name="input_s3_bucket_names"></a> [s3\_bucket\_names](#input\_s3\_bucket\_names) | n/a | `list(string)` | `[]` | no |
4242
| <a name="input_sse_algorithm"></a> [sse\_algorithm](#input\_sse\_algorithm) | The server-side encryption algorithm to use. Valid values are AES256 and aws:kms, defaults to aws:kms. | `string` | `"aws:kms"` | no |
4343
| <a name="input_tags"></a> [tags](#input\_tags) | n/a | `map(any)` | `{}` | no |
44+
| <a name="input_version_lifecycle_expiration_days"></a> [version\_lifecycle\_expiration\_days](#input\_version\_lifecycle\_expiration\_days) | Number of days for a bucket version's lifecycle to expire. Defaults to 0, which disables the rule | `number` | `"0"` | no |
4445
| <a name="input_versioning_enabled"></a> [versioning\_enabled](#input\_versioning\_enabled) | n/a | `bool` | `false` | no |
4546

4647
## Outputs

main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "bucket" {
136136
# Lifecycle configuration for the dev buckets to remove all objects older than var.lifecycle_expiration_days.
137137
resource "aws_s3_bucket_lifecycle_configuration" "lifecycle_expiration_days" {
138138
## Iterate over the list from var's to avoid some chicken/egg problems
139-
for_each = var.lifecycle_expiration_days || var.version_lifecycle_expiration_days > 0 ? toset(var.s3_bucket_names) : []
139+
for_each = (var.lifecycle_expiration_days > 0) || (var.version_lifecycle_expiration_days > 0) ? toset(var.s3_bucket_names) : []
140140
## Refer to the id from the bucket resource to retain the dependency
141141
bucket = aws_s3_bucket.landing_zone_buckets[each.value].id
142142

143143
dynamic "rule" {
144-
for_each = var.lifecycle_expiration_days > 0 ? [1] : []
144+
for_each = var.lifecycle_expiration_days > 0 ? var.s3_bucket_names : []
145145

146146
content {
147147
id = "delete-old-objects"
@@ -155,8 +155,8 @@ resource "aws_s3_bucket_lifecycle_configuration" "lifecycle_expiration_days" {
155155
}
156156
}
157157

158-
dynamic "version_rule" {
159-
for_each = var.version_lifecycle_expiration_days > 0 ? [1] : []
158+
dynamic "rule" {
159+
for_each = var.version_lifecycle_expiration_days > 0 ? var.s3_bucket_names : []
160160

161161
content {
162162
id = "delete-old-versions"

0 commit comments

Comments
 (0)