Skip to content

Commit

Permalink
crates-io: Use dynamic block to reduce duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Jun 5, 2024
1 parent 8ae0c44 commit a0e6a04
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions terragrunt/modules/crates-io/s3-static.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,18 @@ resource "aws_s3_bucket" "static" {
// Keep only the live db-dumps and the previous day's versions, removing
// all the other ones. This is needed because we don't want this file to be
// versioned, while all the other ones in the bucket should be versioned.
lifecycle_rule {
id = "purge-db-dump"
enabled = true
prefix = "db-dump.tar.gz"

abort_incomplete_multipart_upload_days = 1
noncurrent_version_expiration {
days = 1
}
}
dynamic "lifecycle_rule" {
for_each = toset(["db-dump.tar.gz", "db-dump.zip"])

lifecycle_rule {
id = "purge-db-dump-zip"
enabled = true
prefix = "db-dump.zip"
content {
id = "purge-${replace(lifecycle_rule.key, ".", "-")}"
enabled = true
prefix = lifecycle_rule.key

abort_incomplete_multipart_upload_days = 1
noncurrent_version_expiration {
days = 1
abort_incomplete_multipart_upload_days = 1
noncurrent_version_expiration {
days = 1
}
}
}

Expand Down

0 comments on commit a0e6a04

Please sign in to comment.