From 334aca391403835cc0aa3f5be12fe089d608208b Mon Sep 17 00:00:00 2001 From: janli Date: Wed, 11 Sep 2024 14:38:38 -0700 Subject: [PATCH] fix: change coalesce function to try --- k8s-readonly.tf | 2 +- templates.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/k8s-readonly.tf b/k8s-readonly.tf index deedba7..d2ce9c4 100644 --- a/k8s-readonly.tf +++ b/k8s-readonly.tf @@ -70,7 +70,7 @@ resource "kubernetes_deployment_v1" "apiary_hms_readonly" { env { name = "MYSQL_HOST" - value = var.external_database_host == "" ? join("", aws_rds_cluster.apiary_cluster.*.endpoint) : coalesce(var.external_database_host_readonly,var.external_database_host) + value = var.external_database_host == "" ? join("", aws_rds_cluster.apiary_cluster.*.endpoint) : try(var.external_database_host_readonly,var.external_database_host) } env { diff --git a/templates.tf b/templates.tf index af1cfdd..8ed1390 100644 --- a/templates.tf +++ b/templates.tf @@ -75,7 +75,7 @@ locals{ }) hms_readonly_template = templatefile("${path.module}/templates/apiary-hms-readonly.json", { - mysql_db_host = "${var.external_database_host == "" ? join("", aws_rds_cluster.apiary_cluster.*.reader_endpoint) : coalesce(var.external_database_host_readonly,var.external_database_host)}" + mysql_db_host = "${var.external_database_host == "" ? join("", aws_rds_cluster.apiary_cluster.*.reader_endpoint) : try(var.external_database_host_readonly,var.external_database_host)}" mysql_db_name = "${var.apiary_database_name}" mysql_secret_arn = "${data.aws_secretsmanager_secret.db_ro_user.arn}" hive_metastore_access_mode = "readonly"