From 9c3cecd4ce825f0d2e0e0ba05f46a61321ea3c70 Mon Sep 17 00:00:00 2001 From: pierre Date: Tue, 3 Mar 2026 23:46:36 +0000 Subject: [PATCH] more testing with default creds --- module.tf | 14 ++++++++ variables.auto.tfvars | 78 ++++++++++++++++--------------------------- 2 files changed, 43 insertions(+), 49 deletions(-) diff --git a/module.tf b/module.tf index 67e7b4a..6e202a5 100644 --- a/module.tf +++ b/module.tf @@ -426,8 +426,22 @@ resource "kubernetes_deployment_v1" "automatic" { name = env_from.value } } + } } + dynamic "env_from" { + for_each = each.value.database != null && each.value.enabled == true && !(try(each.value.database.shunt, false)) ? ["${each.key}-db-terraform"] : [] + #for_each = each.value.database != null && each.value.enabled == true ? ["${each.key}-db-terraform"] : [] + content { + dynamic "secret_ref" { + for_each = [1] + content { + name = env_from.value + } + } + } + } + dynamic "env_from" { for_each = each.value.config_map_ref != null ? each.value.config_map_ref : [] content { diff --git a/variables.auto.tfvars b/variables.auto.tfvars index 8e562d5..97a28d6 100644 --- a/variables.auto.tfvars +++ b/variables.auto.tfvars @@ -15,56 +15,8 @@ kubernetes = { username = "bookstack_username" name = "bookstackapp" } - # requirements = { - # limits-cpu = "18m" - # limits-memory = "100Mi" - # requests-cpu = "10m" - # requests-memory = "70Mi" - # } - secret_ref = ["bookstack-credentials"] + # secret_ref = ["bookstack-credentials"] config_map_ref = ["config"] - - environment = { - POSTGRES_HOST = { - value = "db" - } - } - - environment = { - MYSQL_ROOT_PASSWORD = { - value_from = { - secret_key_ref = { - name = "bookstack-credentials" - key = "DB_PASS" - } - } - } - MYSQL_DATABASE = { - value_from = { - secret_key_ref = { - name = "bookstack-credentials" - key = "DB_DATABASE" - } - } - } - MYSQL_USER = { - value_from = { - secret_key_ref = { - name = "bookstack-credentials" - key = "DB_USER" - } - } - } - MYSQL_PASSWORD = { - value_from = { - secret_key_ref = { - name = "bookstack-credentials" - key = "DB_PASS" - } - } - } - } - pvc = { bookstack-webserver = { name = "bookstack-webserver" @@ -75,6 +27,34 @@ kubernetes = { } } + bookstesting = { + replicas = 01 + #extra_manifest = ["/opt/kubernetes/Bookstack_kube/Bookstack.configmap.yaml", "/opt/kubernetes/Bookstack_kube/Bookstack.secret.yaml"] + image = "linuxserver/bookstack:latest" + service_port = [80, 443] + database = { + "engine" = "mysql" + "image" = "lscr.io/linuxserver/mariadb" + "port" = 3306 + "mountPath" = "/config" + username = "bookstack_username" + name = "bookstackapp" + } + config_map_ref = ["config"] +secret_ref = ["bookstack-credentials"] + config_map_import = ["bb9a8965-994a-4fea-9411-b4020182fa78"] + secret_import = ["d1c2b8c9-71a0-4e47-9d9d-b402018376b6"] + + pvc = { + bookstesting-webserver = { + name = "bookstack-webserver" + pvc = true + pvc_size = "2Gi" + mount_path = "/config" + } + } + } + screeps = { enabled = false