Skip to content

Commit

Permalink
Merge pull request #4526 from consideRatio/pr/bucket-tags
Browse files Browse the repository at this point in the history
terraform, aws: support specifying bucket specific tags
  • Loading branch information
consideRatio authored Jul 30, 2024
2 parents affa5c3 + d2cbfb6 commit 2375ea5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion terraform/aws/buckets.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "aws_s3_bucket" "user_buckets" {
for_each = var.user_buckets
bucket = lower("${var.cluster_name}-${each.key}")
tags = var.tags
tags = merge(var.tags, each.value.tags)
}

resource "aws_s3_bucket_lifecycle_configuration" "user_bucket_expiry" {
Expand Down
4 changes: 3 additions & 1 deletion terraform/aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ variable "user_buckets" {
type = map(
object({
delete_after : optional(number, null),
archival_storageclass_after : optional(number, null)
archival_storageclass_after : optional(number, null),
tags : optional(map(string), {}),
})
)
default = {}
Expand All @@ -40,6 +41,7 @@ variable "user_buckets" {
2. `archival_storageclass_after` - number of days after *creation* an
object in this bucket will be automatically transitioned to a cheaper,
slower storageclass for cost savings. Set to null to not transition.
3. `tags` - bucket specific tags to be merged into the general tags variable.
EOT
}

Expand Down

0 comments on commit 2375ea5

Please sign in to comment.