Skip to content

Commit

Permalink
Merge pull request #94 from UKHomeOffice/lifecycle-config
Browse files Browse the repository at this point in the history
refactor lifecycle config when only tags are specified
  • Loading branch information
nefischer authored May 19, 2022
2 parents 141f932 + 96e01b1 commit ff11af9
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ resource "aws_s3_bucket_lifecycle_configuration" "this" {
for_each = length(var.lifecycle_infrequent_storage_object_tags) > 0 && var.lifecycle_infrequent_storage_object_prefix == "" ? [1] : []
content {
and {
// the `tag` construct cannot be used because it allows only to specify 1 tag and not a map
// the `and` construct requires at least 2 predicates
// so we're making one up that is always true with object_size_greater_than
object_size_greater_than = 1
tags = var.lifecycle_infrequent_storage_object_tags
tags = var.lifecycle_infrequent_storage_object_tags
}
}
}
Expand Down Expand Up @@ -159,11 +155,7 @@ resource "aws_s3_bucket_lifecycle_configuration" "this" {
for_each = length(var.lifecycle_glacier_object_tags) > 0 && var.lifecycle_glacier_object_prefix == "" ? [1] : []
content {
and {
// the `tag` construct cannot be used because it allows only to specify 1 tag and not a map
// the `and` construct requires at least 2 predicates
// so we're making one up that is always true with object_size_greater_than
object_size_greater_than = 1
tags = var.lifecycle_glacier_object_tags
tags = var.lifecycle_glacier_object_tags
}
}
}
Expand Down Expand Up @@ -207,11 +199,7 @@ resource "aws_s3_bucket_lifecycle_configuration" "this" {
for_each = length(var.lifecycle_expiration_object_tags) > 0 && var.lifecycle_expiration_object_prefix == "" ? [1] : []
content {
and {
// the `tag` construct cannot be used because it allows only to specify 1 tag and not a map
// the `and` construct requires at least 2 predicates
// so we're making one up that is always true with object_size_greater_than
object_size_greater_than = 1
tags = var.lifecycle_expiration_object_tags
tags = var.lifecycle_expiration_object_tags
}
}
}
Expand Down

0 comments on commit ff11af9

Please sign in to comment.