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

Commit

Permalink
Merge pull request #1 from CMS-Enterprise/BATIAI-1679-pre-cluster-buc…
Browse files Browse the repository at this point in the history
…kets

BATIAI-1679 - initial commit
  • Loading branch information
j-mowery authored Jul 12, 2023
2 parents aac17f5 + bb669db commit 5c21744
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
28 changes: 28 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
locals {
default_parameters = {
bucket_name_override = ""
force_destroy = false
tags = {}
s3_bucket_kms_key_id = null
sse_algorithm = "aws:kms"
lifecycle_expiration_days = null
}
default_buckets = {
gatus = local.default_parameters
loki = local.default_parameters
thanos = local.default_parameters
velero = local.default_parameters
}
all_buckets = merge(local.default_buckets, var.bucket_specs)
}

module "bucket" {
for_each = local.all_buckets
source = "git::git@github.com:CMS-Enterprise/batcave-tf-buckets.git//.?ref=0.4.0"
s3_bucket_names = [coalesce(each.value.bucket_name_override, "${var.cluster_name}-${each.key}")]
force_destroy = each.value.force_destroy
tags = merge(var.tags, try(each.value.tags, {}))
s3_bucket_kms_key_id = each.value.s3_bucket_kms_key_id
sse_algorithm = each.value.sse_algorithm
lifecycle_expiration_days = each.value.lifecycle_expiration_days
}
16 changes: 16 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
output "gatus_s3_buckets" {
value = module.bucket["gatus"].s3_buckets
}

output "loki_s3_buckets" {
value = module.bucket["loki"].s3_buckets
}

output "thanos_s3_buckets" {
value = module.bucket["thanos"].s3_buckets
}

output "velero_s3_buckets" {
value = module.bucket["velero"].s3_buckets
}

20 changes: 20 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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)
}))
default = {}
}

variable "cluster_name" {
type = string
}

variable "tags" {
type = map(any)
default = {}
}

0 comments on commit 5c21744

Please sign in to comment.