From 60863c36b7a8860c375adf61752f390e8cbc26fd Mon Sep 17 00:00:00 2001 From: Mohcine Tor Date: Mon, 30 Mar 2026 12:28:37 +0200 Subject: [PATCH 1/2] fix nginx indentation issue --- modules/chart_ingress_nginx/main.tf | 9 ++++----- modules/chart_ingress_nginx/values.yaml | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/chart_ingress_nginx/main.tf b/modules/chart_ingress_nginx/main.tf index 7ac0d0e..8975adb 100644 --- a/modules/chart_ingress_nginx/main.tf +++ b/modules/chart_ingress_nginx/main.tf @@ -1,10 +1,9 @@ -data "template_file" "nginx_values" { - template = file("${path.module}/values.yaml") - vars = { +locals { + nginx_values = templatefile("${path.module}/values.yaml", { service_annotations = yamlencode(var.service_annotations) lb_annotations = yamlencode(var.lb_annotations) platform_lb_ip = var.platform_lb_ip - } + }) } resource "helm_release" "nginx_ingress" { @@ -15,5 +14,5 @@ resource "helm_release" "nginx_ingress" { namespace = "ingress-nginx" create_namespace = true - values = [data.template_file.nginx_values.rendered] + values = [local.nginx_values] } \ No newline at end of file diff --git a/modules/chart_ingress_nginx/values.yaml b/modules/chart_ingress_nginx/values.yaml index b27445a..b97d4dc 100644 --- a/modules/chart_ingress_nginx/values.yaml +++ b/modules/chart_ingress_nginx/values.yaml @@ -21,7 +21,7 @@ controller: http: 80 https: 443 annotations: - ${lb_annotations} + ${indent(6, lb_annotations)} labels: networking/traffic-allowed: "yes" resources: @@ -53,8 +53,8 @@ controller: effect: "NoSchedule" serviceAccount: create: false - annotations: | - ${service_annotations} + annotations: + ${indent(6, service_annotations)} defaultBackend: podLabels: networking/traffic-allowed: "yes" From d1cdb5a8f24ba75aa9926aee17e8563307448e1f Mon Sep 17 00:00:00 2001 From: Mohcine Tor Date: Mon, 30 Mar 2026 14:12:59 +0200 Subject: [PATCH 2/2] fix YAML marshaling error in helm values templating --- modules/chart_ingress_nginx/main.tf | 23 ++++++++++++++++++----- modules/chart_ingress_nginx/values.yaml | 6 ++---- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/modules/chart_ingress_nginx/main.tf b/modules/chart_ingress_nginx/main.tf index 8975adb..3a940ed 100644 --- a/modules/chart_ingress_nginx/main.tf +++ b/modules/chart_ingress_nginx/main.tf @@ -1,8 +1,21 @@ + +data "template_file" "nginx_values_static" { + template = file("${path.module}/values.yaml") + vars = { + platform_lb_ip = var.platform_lb_ip + } +} + locals { - nginx_values = templatefile("${path.module}/values.yaml", { - service_annotations = yamlencode(var.service_annotations) - lb_annotations = yamlencode(var.lb_annotations) - platform_lb_ip = var.platform_lb_ip + nginx_values_dynamic = yamlencode({ + controller = { + service = { + annotations = var.lb_annotations + } + serviceAccount = { + annotations = var.service_annotations + } + } }) } @@ -14,5 +27,5 @@ resource "helm_release" "nginx_ingress" { namespace = "ingress-nginx" create_namespace = true - values = [local.nginx_values] + values = [data.template_file.nginx_values_static.rendered, local.nginx_values_dynamic] } \ No newline at end of file diff --git a/modules/chart_ingress_nginx/values.yaml b/modules/chart_ingress_nginx/values.yaml index b97d4dc..a0a1bd8 100644 --- a/modules/chart_ingress_nginx/values.yaml +++ b/modules/chart_ingress_nginx/values.yaml @@ -20,8 +20,7 @@ controller: ports: http: 80 https: 443 - annotations: - ${indent(6, lb_annotations)} + annotations: {} labels: networking/traffic-allowed: "yes" resources: @@ -53,8 +52,7 @@ controller: effect: "NoSchedule" serviceAccount: create: false - annotations: - ${indent(6, service_annotations)} + annotations: {} defaultBackend: podLabels: networking/traffic-allowed: "yes"