added creation of bucket using variables

This commit is contained in:
Sandro La Bruzzo 2024-10-16 12:07:14 +02:00
parent 85cf6eeb1a
commit 35c44845d2
5 changed files with 54 additions and 19 deletions

View File

@ -257,13 +257,9 @@ tenant:
# - name: my-minio-bucket # - name: my-minio-bucket
# objectLock: false # optional # objectLock: false # optional
# region: us-east-1 # optional # region: us-east-1 # optional
buckets: buckets: [ ]
- name: workflow-logs
- name: binaries
- name: graph
# [ "workflow-logs", "binaries", "graph"]
### ###
# Array of Kubernetes secrets from which the Operator generates MinIO users during tenant provisioning. # Array of Kubernetes secrets from which the Operator generates MinIO users during tenant provisioning.
# #

27
main.tf
View File

@ -2,20 +2,21 @@ module "minio" {
source = "./modules/minio" source = "./modules/minio"
kube_context = var.kube_context kube_context = var.kube_context
namespace_prefix=var.namespace_prefix namespace_prefix=var.namespace_prefix
buckets = var.minio_buckets
} }
module "airflow" { # module "airflow" {
source = "./modules/airflow" # source = "./modules/airflow"
kube_context = var.kube_context # kube_context = var.kube_context
admin_user = var.admin_user # admin_user = var.admin_user
admin_password = var.admin_password # admin_password = var.admin_password
namespace_prefix= var.namespace_prefix # namespace_prefix= var.namespace_prefix
admin_hash = var.admin_hash # admin_hash = var.admin_hash
env = var.env # env = var.env
domain = var.domain # domain = var.domain
s3_endpoint = var.s3_endpoint # s3_endpoint = var.s3_endpoint
s3_key = var.s3_key # s3_key = var.s3_key
s3_secret = var.s3_secret # s3_secret = var.s3_secret
} # }

View File

@ -21,4 +21,26 @@ resource "helm_release" "minio_tenant" {
name = "ingress.console.host" name = "ingress.console.host"
value = "console-minio.${var.domain}" value = "console-minio.${var.domain}"
} }
dynamic "set" {
for_each = var.buckets
content {
name = "tenant.buckets[${set.key}].name"
value = set.value.name
}
}
# set {
# name = "tenant.buckets[0].name"
# value = "workflow-logs"
# }
# set {
# name = "tenant.buckets[1].name"
# value = "binaries"
# }
# ,"binaries","graph","pippo"]
} }

View File

@ -22,3 +22,9 @@ variable "domain" {
type = string type = string
default = "local-dataplatform" default = "local-dataplatform"
} }
variable "buckets" {
type = list(map(string))
default = [ ]
}

View File

@ -44,3 +44,13 @@ variable "s3_key" {
variable "s3_secret" { variable "s3_secret" {
default = "minio123" default = "minio123"
} }
variable "minio_buckets" {
type = list(map(string))
default = [
{ name = "workflow-logs" },
{ name = "binaries" },
{ name = "graph" },
]
}