From 24cf79be92dd31b5613ddf2d6c6cc3e11b90d268 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 10:36:10 +0100 Subject: [PATCH 01/44] refs platform/3237: Add local variable to aggregate project data for Drupal applications --- outputs.tf | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/outputs.tf b/outputs.tf index f6bc838..3b38f12 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,3 +1,15 @@ +locals { + all_data = { + for p in var.drupal_projects_list : "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" => { + # Add the values you want to store for each project here + # Example: + namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace + database_credentials = module.drupal_databases_and_users["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"].sql_users_creds + bucket_credentials = module.drupal_buckets["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"].buckets_access_credentials + } + } +} + output "drupal_apps_database_credentials" { sensitive = true description = "Drupal apps database credentials for each Drupal project." From fbeb2977701ddf36a32d872dbfebef6abce2a4ee Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 10:48:46 +0100 Subject: [PATCH 02/44] Fix output references for database and bucket credentials; add output for all project data --- outputs.tf | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/outputs.tf b/outputs.tf index 3b38f12..2bee67b 100644 --- a/outputs.tf +++ b/outputs.tf @@ -4,12 +4,17 @@ locals { # Add the values you want to store for each project here # Example: namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace - database_credentials = module.drupal_databases_and_users["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"].sql_users_creds - bucket_credentials = module.drupal_buckets["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"].buckets_access_credentials + database_credentials = module.drupal_databases_and_users[0]["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"].sql_users_creds + bucket_credentials = module.drupal_buckets[0]["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"].buckets_access_credentials } } } +output "all_data_output" { + description = "All data for each Drupal project." + value = local.all_data +} + output "drupal_apps_database_credentials" { sensitive = true description = "Drupal apps database credentials for each Drupal project." From d3ddabc2716f22c69d94de59ba029758c97d6f4c Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 11:09:27 +0100 Subject: [PATCH 03/44] Fix output references for database and bucket credentials in outputs.tf --- outputs.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/outputs.tf b/outputs.tf index 2bee67b..6742e29 100644 --- a/outputs.tf +++ b/outputs.tf @@ -4,8 +4,8 @@ locals { # Add the values you want to store for each project here # Example: namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace - database_credentials = module.drupal_databases_and_users[0]["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"].sql_users_creds - bucket_credentials = module.drupal_buckets[0]["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"].buckets_access_credentials + database_credentials = module.drupal_databases_and_users[0].sql_users_creds["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"] + bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"] } } } From ec693f15f5793856174ba6d745f3584aa92e47d0 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 11:12:24 +0100 Subject: [PATCH 04/44] test --- outputs.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/outputs.tf b/outputs.tf index 6742e29..03d38fe 100644 --- a/outputs.tf +++ b/outputs.tf @@ -4,8 +4,8 @@ locals { # Add the values you want to store for each project here # Example: namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace - database_credentials = module.drupal_databases_and_users[0].sql_users_creds["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"] - bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"] + database_credentials = module.drupal_databases_and_users[0].sql_users_creds + bucket_credentials = module.drupal_buckets[0].buckets_access_credentials } } } From f45d04fc867d947b5fa8550abd793348edd862bb Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 11:18:40 +0100 Subject: [PATCH 05/44] fix --- outputs.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/outputs.tf b/outputs.tf index 03d38fe..4e79174 100644 --- a/outputs.tf +++ b/outputs.tf @@ -3,9 +3,9 @@ locals { for p in var.drupal_projects_list : "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" => { # Add the values you want to store for each project here # Example: - namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace - database_credentials = module.drupal_databases_and_users[0].sql_users_creds - bucket_credentials = module.drupal_buckets[0].buckets_access_credentials + namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace + #database_credentials = module.drupal_databases_and_users[0].sql_users_creds + bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"] } } } From 12c4bba36002a10e8693faf8eac6773c380b291d Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 11:21:12 +0100 Subject: [PATCH 06/44] fix --- outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index 4e79174..f58312d 100644 --- a/outputs.tf +++ b/outputs.tf @@ -5,7 +5,7 @@ locals { # Example: namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace #database_credentials = module.drupal_databases_and_users[0].sql_users_creds - bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"] + bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"] } } } From 999b4b2151b6be1c16349039e47501ee43064686 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 11:46:37 +0100 Subject: [PATCH 07/44] db credentials --- outputs.tf | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/outputs.tf b/outputs.tf index f58312d..f20a9b2 100644 --- a/outputs.tf +++ b/outputs.tf @@ -3,13 +3,16 @@ locals { for p in var.drupal_projects_list : "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" => { # Add the values you want to store for each project here # Example: - namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace - #database_credentials = module.drupal_databases_and_users[0].sql_users_creds - bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"] + namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace + bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"] + database_credentials = [for cred in module.drupal_databases_and_users[*].sql_users_creds : cred if cred.database == "${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp"][0] } } } + + + output "all_data_output" { description = "All data for each Drupal project." value = local.all_data From cf20259312161ca8d692f886b7fa1872b26073e5 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 11:55:11 +0100 Subject: [PATCH 08/44] db credentials --- outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index f20a9b2..43cb983 100644 --- a/outputs.tf +++ b/outputs.tf @@ -5,7 +5,7 @@ locals { # Example: namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"] - database_credentials = [for cred in module.drupal_databases_and_users[*].sql_users_creds : cred if cred.database == "${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp"][0] + database_credentials = [for cred in toset(module.drupal_databases_and_users[*].sql_users_creds) : cred if cred.database == "${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp"][0] } } } From 426e277ecdc8b794742ce943f88bde8517c2d1d9 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 11:59:57 +0100 Subject: [PATCH 09/44] fix --- outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index 43cb983..3473b7a 100644 --- a/outputs.tf +++ b/outputs.tf @@ -5,7 +5,7 @@ locals { # Example: namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"] - database_credentials = [for cred in toset(module.drupal_databases_and_users[*].sql_users_creds) : cred if cred.database == "${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp"][0] + database_credentials = [for cred in module.drupal_databases_and_users[0].sql_users_creds : cred if cred.database == "${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp"][0] } } } From 478697d702d26f5f0495c806cbe63e8810b56190 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 12:04:08 +0100 Subject: [PATCH 10/44] fix --- outputs.tf | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/outputs.tf b/outputs.tf index 3473b7a..8733975 100644 --- a/outputs.tf +++ b/outputs.tf @@ -3,9 +3,15 @@ locals { for p in var.drupal_projects_list : "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" => { # Add the values you want to store for each project here # Example: - namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace - bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"] - database_credentials = [for cred in module.drupal_databases_and_users[0].sql_users_creds : cred if cred.database == "${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp"][0] + namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace + bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"] + database_credentials = try( + [ + for cred in module.drupal_databases_and_users[0].sql_users_creds : cred + if cred.database == "${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp" + ][0], + null + ) } } } From 71c7f5b9d3e37e8783afca78e7930967c292b45c Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 15:02:59 +0100 Subject: [PATCH 11/44] Add bucket secrets output to map project identifiers to secret names and namespaces --- outputs.tf | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/outputs.tf b/outputs.tf index 8733975..227d19f 100644 --- a/outputs.tf +++ b/outputs.tf @@ -14,16 +14,32 @@ locals { ) } } + bucket_secrets_map = { + for o in local.drupal_buckets_list : "${replace(o.name, "-drupal", "")}" => { + secret_name = try( + kubernetes_secret.bucket_secret_name[o.name].metadata[0].name, + null + ) + namespace = try( + kubernetes_secret.bucket_secret_name[o.name].metadata[0].namespace, + null + ) + } + } } - - - output "all_data_output" { description = "All data for each Drupal project." value = local.all_data } +output "bucket_secrets" { + description = "Map of project identifiers to their bucket secret names and namespaces" + value = local.bucket_secrets_map +} + + + output "drupal_apps_database_credentials" { sensitive = true description = "Drupal apps database credentials for each Drupal project." From d6bfc1c215230716d76179067f2cc6b274f3e676 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 15:12:54 +0100 Subject: [PATCH 12/44] Add kubernetes_bucket_secret to outputs for project-specific secret mapping --- outputs.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/outputs.tf b/outputs.tf index 227d19f..95b4e58 100644 --- a/outputs.tf +++ b/outputs.tf @@ -12,6 +12,10 @@ locals { ][0], null ) + kubernetes_bucket_secret = try( + local.bucket_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], + null + ) } } bucket_secrets_map = { From e6afae41fce868d71cf0b620b87a3ff13de0e81d Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 15:19:00 +0100 Subject: [PATCH 13/44] Add database secrets mapping to outputs for project identifiers --- outputs.tf | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/outputs.tf b/outputs.tf index 95b4e58..430d98e 100644 --- a/outputs.tf +++ b/outputs.tf @@ -30,8 +30,22 @@ 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}-db"].metadata[0].name, + null + ) + } + } +} + +output "database_secret_names" { + description = "Map of project identifiers to their database secret names" + value = local.database_secrets_map } + output "all_data_output" { description = "All data for each Drupal project." value = local.all_data From 45671d66556dcbbbc324c03a917707ecb9aa9263 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 15:27:33 +0100 Subject: [PATCH 14/44] Fix database secret name mapping for user credentials in outputs --- outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index 430d98e..6a12297 100644 --- a/outputs.tf +++ b/outputs.tf @@ -33,7 +33,7 @@ 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}-db"].metadata[0].name, + kubernetes_secret.database_secret_name["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-db-user"].metadata[0].name, null ) } From d985c5c4fa4b82472b387c36acbaf6245cbe639c Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 15:33:46 +0100 Subject: [PATCH 15/44] Fix database secret name mapping for Drupal projects in outputs --- outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index 6a12297..a64e20c 100644 --- a/outputs.tf +++ b/outputs.tf @@ -33,7 +33,7 @@ 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}-db-user"].metadata[0].name, + kubernetes_secret.database_secret_name["drupal-${p.release_branch_name}-${p.gitlab_project_id}-db-user"].metadata[0].name, null ) } From 7f852fe4910be6fe355e7524ea75d217f764725f Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 16:18:22 +0100 Subject: [PATCH 16/44] Refactor database secret name mapping in outputs for improved clarity and efficiency --- outputs.tf | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/outputs.tf b/outputs.tf index a64e20c..1e82692 100644 --- a/outputs.tf +++ b/outputs.tf @@ -30,19 +30,13 @@ 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["drupal-${p.release_branch_name}-${p.gitlab_project_id}-db-user"].metadata[0].name, - null - ) - } - } } output "database_secret_names" { description = "Map of project identifiers to their database secret names" - value = local.database_secrets_map + value = { + for key, secret in kubernetes_secret.database_secret_name : key => secret.metadata[0].name + } } From 9df3d133887ea5e3d5bc109b2ae85df28f34dd74 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 16:36:07 +0100 Subject: [PATCH 17/44] Add database secrets mapping for Drupal projects in outputs --- outputs.tf | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index 1e82692..adf21ad 100644 --- a/outputs.tf +++ b/outputs.tf @@ -30,12 +30,20 @@ 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, + null + ) + } + } } output "database_secret_names" { description = "Map of project identifiers to their database secret names" value = { - for key, secret in kubernetes_secret.database_secret_name : key => secret.metadata[0].name + for key, secret in kubernetes_secret.database_secret_name : key => secret.metadata[0] } } From d5fa9f9cdf284bfa1ca47aaf8d761080222567ad Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 16:42:16 +0100 Subject: [PATCH 18/44] Enhance database secret names output to include namespaces --- outputs.tf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/outputs.tf b/outputs.tf index adf21ad..e8bf6c3 100644 --- a/outputs.tf +++ b/outputs.tf @@ -41,9 +41,12 @@ locals { } output "database_secret_names" { - description = "Map of project identifiers to their database secret names" + description = "Map of project identifiers to their database secret names and namespaces" value = { - for key, secret in kubernetes_secret.database_secret_name : key => secret.metadata[0] + for key, secret in kubernetes_secret.database_secret_name : key => { + name = secret.metadata[0].name + namespace = secret.metadata[0].namespace + } } } From 3de1128cdebf92242e86b9d2a10d8fba99699852 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 16:50:07 +0100 Subject: [PATCH 19/44] Add namespace information to database secrets mapping output --- outputs.tf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/outputs.tf b/outputs.tf index e8bf6c3..930f328 100644 --- a/outputs.tf +++ b/outputs.tf @@ -34,12 +34,20 @@ locals { 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, + null) + namespace = try( + kubernetes_secret.database_secret_name["${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp"].metadata[0].namespace, null ) } } } +output "database_secrets_map_output" { + description = "Map of project identifiers with their database secret names and namespaces from local map" + value = local.database_secrets_map +} + output "database_secret_names" { description = "Map of project identifiers to their database secret names and namespaces" value = { From 59669126e5929d2d79fded1160024588ca4cd3ad Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 16:53:48 +0100 Subject: [PATCH 20/44] Add Kubernetes database secret mapping to outputs --- outputs.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/outputs.tf b/outputs.tf index 930f328..f23b76b 100644 --- a/outputs.tf +++ b/outputs.tf @@ -16,6 +16,10 @@ locals { local.bucket_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], null ) + kubernetes_database_secret = try( + local.database_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], + null + ) } } bucket_secrets_map = { From a8a076ccf3d26792d241591cadbf7fab80ea9e87 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 17:24:22 +0100 Subject: [PATCH 21/44] Refactor outputs to streamline database and bucket secret mappings --- outputs.tf | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/outputs.tf b/outputs.tf index f23b76b..00f0b11 100644 --- a/outputs.tf +++ b/outputs.tf @@ -5,6 +5,10 @@ locals { # Example: namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"] + kubernetes_bucket_secret = try( + local.bucket_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], + null + ) database_credentials = try( [ for cred in module.drupal_databases_and_users[0].sql_users_creds : cred @@ -12,10 +16,6 @@ locals { ][0], null ) - kubernetes_bucket_secret = try( - local.bucket_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], - null - ) kubernetes_database_secret = try( local.database_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], null @@ -47,34 +47,11 @@ locals { } } -output "database_secrets_map_output" { - description = "Map of project identifiers with their database secret names and namespaces from local map" - value = local.database_secrets_map -} - -output "database_secret_names" { - description = "Map of project identifiers to their database secret names and namespaces" - value = { - for key, secret in kubernetes_secret.database_secret_name : key => { - name = secret.metadata[0].name - namespace = secret.metadata[0].namespace - } - } -} - - output "all_data_output" { description = "All data for each Drupal project." value = local.all_data } -output "bucket_secrets" { - description = "Map of project identifiers to their bucket secret names and namespaces" - value = local.bucket_secrets_map -} - - - output "drupal_apps_database_credentials" { sensitive = true description = "Drupal apps database credentials for each Drupal project." From 165b7f594daa87e276240e8fdef8d3adbe37953d Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 17:28:49 +0100 Subject: [PATCH 22/44] Refactor kubernetes_bucket_secret mapping in outputs to improve consistency --- outputs.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/outputs.tf b/outputs.tf index 00f0b11..086b1f8 100644 --- a/outputs.tf +++ b/outputs.tf @@ -5,10 +5,6 @@ locals { # Example: namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"] - kubernetes_bucket_secret = try( - local.bucket_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], - null - ) database_credentials = try( [ for cred in module.drupal_databases_and_users[0].sql_users_creds : cred @@ -16,6 +12,10 @@ locals { ][0], null ) + kubernetes_bucket_secret = try( + local.bucket_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], + null + ) kubernetes_database_secret = try( local.database_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], null From 76ed68935da94b84f6052d86477987ca01351b5c Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 17:29:46 +0100 Subject: [PATCH 23/44] Refactor output credential retrieval to use try for safer access --- outputs.tf | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/outputs.tf b/outputs.tf index 086b1f8..2b2f562 100644 --- a/outputs.tf +++ b/outputs.tf @@ -4,22 +4,12 @@ locals { # Add the values you want to store for each project here # Example: namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace - bucket_credentials = module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"] + bucket_credentials = try(module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"], null) database_credentials = try( - [ - for cred in module.drupal_databases_and_users[0].sql_users_creds : cred - if cred.database == "${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp" - ][0], - null - ) - kubernetes_bucket_secret = try( - local.bucket_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], - null - ) - kubernetes_database_secret = try( - local.database_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], - null - ) + [for cred in module.drupal_databases_and_users[0].sql_users_creds : cred + if cred.database == "${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp"][0], null) + kubernetes_bucket_secret = try(local.bucket_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], null) + kubernetes_database_secret = try(local.database_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], null) } } bucket_secrets_map = { From 2a83f3051ee09d9f609e6352cfef84ccb6794e7c Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 17:38:12 +0100 Subject: [PATCH 24/44] Add output for all bucket credentials to enhance project data accessibility --- outputs.tf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/outputs.tf b/outputs.tf index 2b2f562..0c9339a 100644 --- a/outputs.tf +++ b/outputs.tf @@ -12,6 +12,7 @@ locals { kubernetes_database_secret = try(local.database_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], null) } } + bucket_secrets_map = { for o in local.drupal_buckets_list : "${replace(o.name, "-drupal", "")}" => { secret_name = try( @@ -24,6 +25,7 @@ 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( @@ -42,6 +44,12 @@ output "all_data_output" { value = local.all_data } +output "all_bucket_credentials" { + description = "Bucket credentials for each Drupal project from all_data map" + sensitive = true + value = local.all_data[*].bucket_credentials +} + output "drupal_apps_database_credentials" { sensitive = true description = "Drupal apps database credentials for each Drupal project." From e84ff4e4635e06d208c403679130a6968fd5671d Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 17:46:30 +0100 Subject: [PATCH 25/44] Refactor all_data structure to use a list for improved data handling --- outputs.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/outputs.tf b/outputs.tf index 0c9339a..d81f424 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,5 +1,5 @@ locals { - all_data = { + all_data = [ for p in var.drupal_projects_list : "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" => { # Add the values you want to store for each project here # Example: @@ -11,7 +11,7 @@ locals { kubernetes_bucket_secret = try(local.bucket_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], null) kubernetes_database_secret = try(local.database_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], null) } - } + ] bucket_secrets_map = { for o in local.drupal_buckets_list : "${replace(o.name, "-drupal", "")}" => { From fc56441e5bc808de0b4573aed818f085ef7e84e7 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 17:47:27 +0100 Subject: [PATCH 26/44] Refactor all_data structure to use a map for improved data retrieval --- outputs.tf | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/outputs.tf b/outputs.tf index d81f424..2117374 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,5 +1,5 @@ locals { - all_data = [ + all_data = { for p in var.drupal_projects_list : "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" => { # Add the values you want to store for each project here # Example: @@ -11,7 +11,7 @@ locals { kubernetes_bucket_secret = try(local.bucket_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], null) kubernetes_database_secret = try(local.database_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], null) } - ] + } bucket_secrets_map = { for o in local.drupal_buckets_list : "${replace(o.name, "-drupal", "")}" => { @@ -47,7 +47,9 @@ output "all_data_output" { output "all_bucket_credentials" { description = "Bucket credentials for each Drupal project from all_data map" sensitive = true - value = local.all_data[*].bucket_credentials + value = { + for key, value in local.all_data : key => value.bucket_credentials + } } output "drupal_apps_database_credentials" { From 62c45f27360480cf57553000a47d63e71aefb28e Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 17:55:43 +0100 Subject: [PATCH 27/44] Add outputs for Drupal project credentials and secrets for enhanced data management --- outputs.tf | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/outputs.tf b/outputs.tf index 2117374..081a051 100644 --- a/outputs.tf +++ b/outputs.tf @@ -39,19 +39,43 @@ locals { } } -output "all_data_output" { +output "drupal_all_data" { description = "All data for each Drupal project." value = local.all_data } -output "all_bucket_credentials" { - description = "Bucket credentials for each Drupal project from all_data map" +output "drupal_all_bucket_credentials" { + description = "Bucket credentials for each Drupal project" sensitive = true value = { for key, value in local.all_data : key => value.bucket_credentials } } +output "drupal_all_database_credentials" { + description = "Database credentials for each Drupal project" + sensitive = true + value = { + for key, value in local.all_data : key => value.database_credentials + } +} + +output "drupal_all_bucket_secrets" { + description = "Bucket kubernetes secrets for each Drupal project" + sensitive = true + value = { + for key, value in local.all_data : key => value.kubernetes_bucket_secret + } +} + +output "drupal_all_database_secrets" { + description = "Database kubernetes secrets for each Drupal project" + sensitive = true + value = { + for key, value in local.all_data : key => value.kubernetes_database_secret + } +} + output "drupal_apps_database_credentials" { sensitive = true description = "Drupal apps database credentials for each Drupal project." From 1685bf68ef39182a435186173f45398eed7bd50d Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 17:58:22 +0100 Subject: [PATCH 28/44] Add output for Drupal project namespaces to enhance project configuration --- outputs.tf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/outputs.tf b/outputs.tf index 081a051..25cc2e5 100644 --- a/outputs.tf +++ b/outputs.tf @@ -76,6 +76,14 @@ output "drupal_all_database_secrets" { } } +output "drupal_all_namespaces" { + description = "Namespace for each Drupal project" + sensitive = true + value = { + for key, value in local.all_data : key => value.namespace + } +} + output "drupal_apps_database_credentials" { sensitive = true description = "Drupal apps database credentials for each Drupal project." From 1bbe50c4200e11cdbb8ef43363c3cc111b2dd301 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 18:05:04 +0100 Subject: [PATCH 29/44] Refactor output definitions for Drupal bucket secrets and namespaces for improved clarity --- outputs.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/outputs.tf b/outputs.tf index 25cc2e5..631a04b 100644 --- a/outputs.tf +++ b/outputs.tf @@ -14,7 +14,7 @@ locals { } bucket_secrets_map = { - for o in local.drupal_buckets_list : "${replace(o.name, "-drupal", "")}" => { + for o in local.drupal_buckets_list : replace(o.name, "-drupal", "") => { secret_name = try( kubernetes_secret.bucket_secret_name[o.name].metadata[0].name, null @@ -80,7 +80,7 @@ output "drupal_all_namespaces" { description = "Namespace for each Drupal project" sensitive = true value = { - for key, value in local.all_data : key => value.namespace + for key, value in local.all_data : key => value. } } From c6ae40a459d5df3053f8931e9f6f31382bc55504 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 18:06:32 +0100 Subject: [PATCH 30/44] Fix output for Drupal namespaces to correctly reference the namespace property --- outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index 631a04b..77fa9de 100644 --- a/outputs.tf +++ b/outputs.tf @@ -80,7 +80,7 @@ output "drupal_all_namespaces" { description = "Namespace for each Drupal project" sensitive = true value = { - for key, value in local.all_data : key => value. + for key, value in local.all_data : key => value.namespace } } From db016a531420f380087094deea6fee5fd1bdd8ef Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Thu, 28 Nov 2024 18:08:37 +0100 Subject: [PATCH 31/44] Add outputs for Drupal project credentials, secrets, and namespaces in README --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index db05af9..6fcf233 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,12 @@ the random suffix `bucket_append_random_suffix` for the bucket name. | [cloudsql\_dumps\_bucket\_name](#output\_cloudsql\_dumps\_bucket\_name) | CloudSQL dumps bucket name. | | [details\_of\_used\_tag\_keys](#output\_details\_of\_used\_tag\_keys) | Details of the tag keys passed to this module. | | [details\_of\_used\_tag\_values](#output\_details\_of\_used\_tag\_values) | Details of the tag values passed to this module. | +| [drupal\_all\_bucket\_credentials](#output\_drupal\_all\_bucket\_credentials) | Bucket credentials for each Drupal project | +| [drupal\_all\_bucket\_secrets](#output\_drupal\_all\_bucket\_secrets) | Bucket kubernetes secrets for each Drupal project | +| [drupal\_all\_data](#output\_drupal\_all\_data) | All data for each Drupal project. | +| [drupal\_all\_database\_credentials](#output\_drupal\_all\_database\_credentials) | Database credentials for each Drupal project | +| [drupal\_all\_database\_secrets](#output\_drupal\_all\_database\_secrets) | Database kubernetes secrets for each Drupal project | +| [drupal\_all\_namespaces](#output\_drupal\_all\_namespaces) | Namespace for each Drupal project | | [drupal\_apps\_bucket\_credentials](#output\_drupal\_apps\_bucket\_credentials) | Drupal apps bucket credentials for each Drupal project. | | [drupal\_apps\_database\_credentials](#output\_drupal\_apps\_database\_credentials) | Drupal apps database credentials for each Drupal project. | | [drupal\_buckets\_names\_list](#output\_drupal\_buckets\_names\_list) | The list with the names of the Drupal buckets managed by this module. | From e26dde8fbe00f3c74d33adc6cb7da76c87b00bd3 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Fri, 29 Nov 2024 09:07:12 +0100 Subject: [PATCH 32/44] Remove sensitive flag from Drupal all namespaces output for improved clarity --- outputs.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index 77fa9de..d1bdf09 100644 --- a/outputs.tf +++ b/outputs.tf @@ -78,7 +78,6 @@ output "drupal_all_database_secrets" { output "drupal_all_namespaces" { description = "Namespace for each Drupal project" - sensitive = true value = { for key, value in local.all_data : key => value.namespace } From 4c8532ab7a2760215085d3d8839ae91ba1b5dde2 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Fri, 29 Nov 2024 11:59:20 +0100 Subject: [PATCH 33/44] 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 ) } From 1bc7610ba96d971cd643072a5fc81d53fbe06931 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Fri, 29 Nov 2024 12:03:59 +0100 Subject: [PATCH 34/44] Fix bucket secret name and namespace retrieval to replace hyphens with underscores --- outputs.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/outputs.tf b/outputs.tf index 66153a0..bfa160e 100644 --- a/outputs.tf +++ b/outputs.tf @@ -16,11 +16,11 @@ locals { bucket_secrets_map = { for o in local.drupal_buckets_list : replace(o.name, "-drupal", "") => { secret_name = try( - kubernetes_secret.bucket_secret_name[o.name].metadata[0].name, + kubernetes_secret.bucket_secret_name[replace("o.name", "-", "_")].metadata[0].name, null ) namespace = try( - kubernetes_secret.bucket_secret_name[o.name].metadata[0].namespace, + kubernetes_secret.bucket_secret_name[replace("o.name", "-", "_")].metadata[0].namespace, null ) } From 2b4326f576b40039be175acff6104951fdf2ee7c Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Fri, 29 Nov 2024 12:16:02 +0100 Subject: [PATCH 35/44] Fix bucket secret name and namespace retrieval to use correct variable reference --- outputs.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/outputs.tf b/outputs.tf index bfa160e..66153a0 100644 --- a/outputs.tf +++ b/outputs.tf @@ -16,11 +16,11 @@ locals { bucket_secrets_map = { for o in local.drupal_buckets_list : replace(o.name, "-drupal", "") => { secret_name = try( - kubernetes_secret.bucket_secret_name[replace("o.name", "-", "_")].metadata[0].name, + kubernetes_secret.bucket_secret_name[o.name].metadata[0].name, null ) namespace = try( - kubernetes_secret.bucket_secret_name[replace("o.name", "-", "_")].metadata[0].namespace, + kubernetes_secret.bucket_secret_name[o.name].metadata[0].namespace, null ) } From 430520981e5bb4a9334573feed52cad50f176e88 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Fri, 29 Nov 2024 12:21:35 +0100 Subject: [PATCH 36/44] Fix database credentials retrieval to replace hyphens with underscores --- outputs.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index 66153a0..58e43c4 100644 --- a/outputs.tf +++ b/outputs.tf @@ -7,7 +7,7 @@ locals { bucket_credentials = try(module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"], null) database_credentials = try( [for cred in module.drupal_databases_and_users[0].sql_users_creds : cred - if cred.database == "${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp"][0], null) + if cred.database == replace("${p.project_name}_${p.gitlab_project_id}_${p.release_branch_name}_dp", "-", "_")][0], null) kubernetes_bucket_secret = try(local.bucket_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], null) kubernetes_database_secret = try(local.database_secrets_map["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}"], null) } @@ -39,6 +39,7 @@ locals { } } + output "drupal_all_data" { description = "All data for each Drupal project." value = local.all_data From 3ddd9676a9c2d3e72b1896a996230ffeaa459824 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Fri, 29 Nov 2024 12:47:16 +0100 Subject: [PATCH 37/44] Add helm_release_name to outputs for dynamic naming based on project details --- outputs.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/outputs.tf b/outputs.tf index 58e43c4..cb32781 100644 --- a/outputs.tf +++ b/outputs.tf @@ -4,6 +4,7 @@ locals { # Add the values you want to store for each project here # Example: namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace + helm_release_name = p.helm_release_name == null ? "drupal-${p.release_branch_name}-${p.project_id}" : p.helm_release_name bucket_credentials = try(module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"], null) database_credentials = try( [for cred in module.drupal_databases_and_users[0].sql_users_creds : cred From a622eb2e348288542374677bd535f3a68fdf112a Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Fri, 29 Nov 2024 12:49:15 +0100 Subject: [PATCH 38/44] Fix helm_release_name output to use gitlab_project_id instead of project_id for dynamic naming --- outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index cb32781..9402d64 100644 --- a/outputs.tf +++ b/outputs.tf @@ -4,7 +4,7 @@ locals { # Add the values you want to store for each project here # Example: namespace = p.kubernetes_namespace == null ? "${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}" : p.kubernetes_namespace - helm_release_name = p.helm_release_name == null ? "drupal-${p.release_branch_name}-${p.project_id}" : p.helm_release_name + helm_release_name = p.helm_release_name == null ? "drupal-${p.release_branch_name}-${p.gitlab_project_id}" : p.helm_release_name bucket_credentials = try(module.drupal_buckets[0].buckets_access_credentials["${p.project_name}-${p.gitlab_project_id}-${p.release_branch_name}-drupal"], null) database_credentials = try( [for cred in module.drupal_databases_and_users[0].sql_users_creds : cred From b8fc2d7cdc3cfd429e5dddc18300037c25ffb4d7 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Fri, 29 Nov 2024 14:02:09 +0100 Subject: [PATCH 39/44] Add kubernetes_namespace_labels to README for namespace label configuration --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6fcf233..a9478fa 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ The variable structure is the following: kubernetes_namespace = optional(string, null) # By default it corresponds to the Drupal PKG release that corresponds to # drupal-${CI_COMMIT_REF_SLUG}-${CI_PROJECT_ID} and is used for the name of secrets. + kubernetes_namespace_labels = optional(map(string), {}) + # Namespace labels added to default_k8s_labels helm_release_name = optional(string, null) # By default the name is ___dp, where dp stands for Drupal. database_name = optional(string, null) From bedd095ec78da59f0c576892ff98ea4d3526fa35 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia <24303019+Stevesibilia@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:34:33 +0100 Subject: [PATCH 40/44] Update outputs.tf Co-authored-by: Andrea Panisson --- outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index 9402d64..28dfa0c 100644 --- a/outputs.tf +++ b/outputs.tf @@ -41,7 +41,7 @@ locals { } -output "drupal_all_data" { +output "drupal_resources_all_data" { description = "All data for each Drupal project." value = local.all_data } From 81ffa57d2b37761e6e4bcda30c96eeacca01870f Mon Sep 17 00:00:00 2001 From: Stefano Sibilia <24303019+Stevesibilia@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:34:42 +0100 Subject: [PATCH 41/44] Update outputs.tf Co-authored-by: Andrea Panisson --- outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index 28dfa0c..d61c70f 100644 --- a/outputs.tf +++ b/outputs.tf @@ -46,7 +46,7 @@ output "drupal_resources_all_data" { value = local.all_data } -output "drupal_all_bucket_credentials" { +output "drupal_resources_all_bucket_credentials" { description = "Bucket credentials for each Drupal project" sensitive = true value = { From 9e49aa7d49304e36b8212c361ac413962ac396b2 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia <24303019+Stevesibilia@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:35:18 +0100 Subject: [PATCH 42/44] Update README.md Co-authored-by: Andrea Panisson --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a9478fa..6bccbb0 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,10 @@ The variable structure is the following: # If not specified, the kubernetes_namespace by default it is built as # --. kubernetes_namespace = optional(string, null) - # By default it corresponds to the Drupal PKG release that corresponds to - # drupal-${CI_COMMIT_REF_SLUG}-${CI_PROJECT_ID} and is used for the name of secrets. - kubernetes_namespace_labels = optional(map(string), {}) # Namespace labels added to default_k8s_labels + kubernetes_namespace_labels = optional(map(string), {}) + # The Helm release name by default corresponds to the Drupal PKG release that corresponds to + # drupal-${CI_COMMIT_REF_SLUG}-${CI_PROJECT_ID} and is used for the name of secrets. helm_release_name = optional(string, null) # By default the name is ___dp, where dp stands for Drupal. database_name = optional(string, null) From 36afbcc50656f06fd0361bd4fe5935e3f07c9036 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Fri, 29 Nov 2024 14:42:10 +0100 Subject: [PATCH 43/44] refs platform/3237: Rename output variables in outputs.tf for consistency with resource naming --- outputs.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/outputs.tf b/outputs.tf index d61c70f..a751a5e 100644 --- a/outputs.tf +++ b/outputs.tf @@ -54,7 +54,7 @@ output "drupal_resources_all_bucket_credentials" { } } -output "drupal_all_database_credentials" { +output "drupal_resources_all_database_credentials" { description = "Database credentials for each Drupal project" sensitive = true value = { @@ -62,7 +62,7 @@ output "drupal_all_database_credentials" { } } -output "drupal_all_bucket_secrets" { +output "drupal_resources_all_bucket_secrets" { description = "Bucket kubernetes secrets for each Drupal project" sensitive = true value = { @@ -70,7 +70,7 @@ output "drupal_all_bucket_secrets" { } } -output "drupal_all_database_secrets" { +output "drupal_resources_all_database_secrets" { description = "Database kubernetes secrets for each Drupal project" sensitive = true value = { @@ -78,7 +78,7 @@ output "drupal_all_database_secrets" { } } -output "drupal_all_namespaces" { +output "drupal_resources_all_namespaces" { description = "Namespace for each Drupal project" value = { for key, value in local.all_data : key => value.namespace From e678d442a31d165c05d97857682b13978be27841 Mon Sep 17 00:00:00 2001 From: Stefano Sibilia Date: Fri, 29 Nov 2024 14:44:19 +0100 Subject: [PATCH 44/44] refs platform/3237: Rename output variables in README.md and outputs.tf for consistency with Drupal project naming --- README.md | 12 ++++++------ outputs.tf | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6bccbb0..2429c90 100644 --- a/README.md +++ b/README.md @@ -145,12 +145,12 @@ the random suffix `bucket_append_random_suffix` for the bucket name. | [cloudsql\_dumps\_bucket\_name](#output\_cloudsql\_dumps\_bucket\_name) | CloudSQL dumps bucket name. | | [details\_of\_used\_tag\_keys](#output\_details\_of\_used\_tag\_keys) | Details of the tag keys passed to this module. | | [details\_of\_used\_tag\_values](#output\_details\_of\_used\_tag\_values) | Details of the tag values passed to this module. | -| [drupal\_all\_bucket\_credentials](#output\_drupal\_all\_bucket\_credentials) | Bucket credentials for each Drupal project | -| [drupal\_all\_bucket\_secrets](#output\_drupal\_all\_bucket\_secrets) | Bucket kubernetes secrets for each Drupal project | -| [drupal\_all\_data](#output\_drupal\_all\_data) | All data for each Drupal project. | -| [drupal\_all\_database\_credentials](#output\_drupal\_all\_database\_credentials) | Database credentials for each Drupal project | -| [drupal\_all\_database\_secrets](#output\_drupal\_all\_database\_secrets) | Database kubernetes secrets for each Drupal project | -| [drupal\_all\_namespaces](#output\_drupal\_all\_namespaces) | Namespace for each Drupal project | +| [drupal\_apps\_all\_bucket\_credentials](#output\_drupal\_apps\_all\_bucket\_credentials) | Bucket credentials for each Drupal project | +| [drupal\_apps\_all\_bucket\_secrets](#output\_drupal\_apps\_all\_bucket\_secrets) | Bucket kubernetes secrets for each Drupal project | +| [drupal\_apps\_all\_data](#output\_drupal\_apps\_all\_data) | All data for each Drupal project. | +| [drupal\_apps\_all\_database\_credentials](#output\_drupal\_apps\_all\_database\_credentials) | Database credentials for each Drupal project | +| [drupal\_apps\_all\_database\_secrets](#output\_drupal\_apps\_all\_database\_secrets) | Database kubernetes secrets for each Drupal project | +| [drupal\_apps\_all\_namespaces](#output\_drupal\_apps\_all\_namespaces) | Namespace for each Drupal project | | [drupal\_apps\_bucket\_credentials](#output\_drupal\_apps\_bucket\_credentials) | Drupal apps bucket credentials for each Drupal project. | | [drupal\_apps\_database\_credentials](#output\_drupal\_apps\_database\_credentials) | Drupal apps database credentials for each Drupal project. | | [drupal\_buckets\_names\_list](#output\_drupal\_buckets\_names\_list) | The list with the names of the Drupal buckets managed by this module. | diff --git a/outputs.tf b/outputs.tf index a751a5e..a99105f 100644 --- a/outputs.tf +++ b/outputs.tf @@ -41,12 +41,12 @@ locals { } -output "drupal_resources_all_data" { +output "drupal_apps_all_data" { description = "All data for each Drupal project." value = local.all_data } -output "drupal_resources_all_bucket_credentials" { +output "drupal_apps_all_bucket_credentials" { description = "Bucket credentials for each Drupal project" sensitive = true value = { @@ -54,7 +54,7 @@ output "drupal_resources_all_bucket_credentials" { } } -output "drupal_resources_all_database_credentials" { +output "drupal_apps_all_database_credentials" { description = "Database credentials for each Drupal project" sensitive = true value = { @@ -62,7 +62,7 @@ output "drupal_resources_all_database_credentials" { } } -output "drupal_resources_all_bucket_secrets" { +output "drupal_apps_all_bucket_secrets" { description = "Bucket kubernetes secrets for each Drupal project" sensitive = true value = { @@ -70,7 +70,7 @@ output "drupal_resources_all_bucket_secrets" { } } -output "drupal_resources_all_database_secrets" { +output "drupal_apps_all_database_secrets" { description = "Database kubernetes secrets for each Drupal project" sensitive = true value = { @@ -78,7 +78,7 @@ output "drupal_resources_all_database_secrets" { } } -output "drupal_resources_all_namespaces" { +output "drupal_apps_all_namespaces" { description = "Namespace for each Drupal project" value = { for key, value in local.all_data : key => value.namespace