Refactor s3 in opentofu to allow internal/external provider selection

This commit is contained in:
Tobias Reisinger 2025-06-08 01:23:40 +02:00
parent 9af19f51fa
commit b336d01858
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
4 changed files with 5 additions and 42 deletions
modules/infrastructure

View file

@ -29,9 +29,7 @@ terraform {
locals {
services_auth = {for key, val in var.services : key => val if val.auth}
services_database = {for key, val in var.services : key => val if val.database}
services_s3 = {for key, val in var.services : key => (val.s3_buckets != null) ? val.s3_buckets : [key] if val.s3}
services_s3 = {for key, val in var.services : key => (val.s3_buckets != null) ? val.s3_buckets : [key] if (val.s3 == "external")}
buckets_s3 = merge([for key, val in local.services_s3 : {for bucket in val : bucket => key}]...)
hetzner_hosts = {for key, val in var.hosts : key => val if val.provider == "hetzner"}

View file

@ -35,7 +35,7 @@ variable "services" {
auth = bool
auth_cert = optional(string)
auth_redirects = optional(list(string))
s3 = bool
s3 = optional(string)
s3_buckets = optional(list(string))
database = bool
}))