Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
BATIAI-1936 - Update Default Bucket Names (#6)
Browse files Browse the repository at this point in the history
* BATIAI-1936 - merge current default name as override

* Fixing bucket prop merge

* Apply suggestions from code review

---------

Co-authored-by: Charles Bushong <charles.bushong@cms.hhs.gov>
Co-authored-by: Charles Bushong <cbushong@fearless.tech>
  • Loading branch information
3 people authored Dec 11, 2023
1 parent 088e137 commit 317630c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
9 changes: 5 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ locals {
lifecycle_expiration_days = null
}
default_buckets = {
loki = local.default_parameters
thanos = local.default_parameters
velero = local.default_parameters
loki = merge(local.default_parameters, {bucket_name_override = "${var.cluster_name}-logs"})
thanos = merge(local.default_parameters, {bucket_name_override = "batcave-${var.cluster_name}-thanos"})
velero = merge(local.default_parameters, {bucket_name_override = "${var.cluster_name}-batcave-velero-storage"})
}
all_buckets = merge(local.default_buckets, var.bucket_specs)
all_bucket_names = toset(concat(keys(local.default_buckets), keys(var.bucket_specs)))
all_buckets = {for name in local.all_bucket_names : name => merge(try(local.default_buckets[name], {}), try(var.bucket_specs[name], {}))}
}

module "bucket" {
Expand Down
18 changes: 10 additions & 8 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
variable "bucket_specs" {
type = map(object({
bucket_name_override = optional(string, "")
force_destroy = optional(bool, false)
tags = optional(map(any), {})
s3_bucket_kms_key_id = optional(string, null)
sse_algorithm = optional(string, "aws:kms")
lifecycle_expiration_days = optional(number, null)
}))
type = map(any)
## Cannot configure strict typing or local default will be blown away by implicit object defaults
#type = map(object({
# bucket_name_override = optional(string)
# force_destroy = optional(bool)
# tags = optional(map(any))
# s3_bucket_kms_key_id = optional(string)
# sse_algorithm = optional(string)
# lifecycle_expiration_days = optional(number)
#}))
default = {}
}

Expand Down

0 comments on commit 317630c

Please sign in to comment.