From 4c8532ab7a2760215085d3d8839ae91ba1b5dde2 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Fri, 29 Nov 2024 11:59:20 +0100 Subject: [PATCH] Fix database secret name and namespace retrieval to handle hyphens correctly --- outputs.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/outputs.tf b/outputs.tf index d1bdf09..66153a0 100644 --- a/outputs.tf +++ b/outputs.tf @@ -29,10 +29,10 @@ locals { database_secrets_map = { for p in var.drupal_projects_list : "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" => { secret_name = try( - kubernetes_secret.database_secret_name["${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp"].metadata[0].name, + kubernetes_secret.database_secret_name[replace("${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp", "-", "_")].metadata[0].name, null) namespace = try( - kubernetes_secret.database_secret_name["${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp"].metadata[0].namespace, + kubernetes_secret.database_secret_name[replace("${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp", "-", "_")].metadata[0].namespace, null ) }