diff --git a/modules/chart_ingress_nginx/main.tf b/modules/chart_ingress_nginx/main.tf index 7ac0d0e..3a940ed 100644 --- a/modules/chart_ingress_nginx/main.tf +++ b/modules/chart_ingress_nginx/main.tf @@ -1,12 +1,24 @@ -data "template_file" "nginx_values" { + +data "template_file" "nginx_values_static" { template = file("${path.module}/values.yaml") vars = { - service_annotations = yamlencode(var.service_annotations) - lb_annotations = yamlencode(var.lb_annotations) - platform_lb_ip = var.platform_lb_ip + platform_lb_ip = var.platform_lb_ip } } +locals { + nginx_values_dynamic = yamlencode({ + controller = { + service = { + annotations = var.lb_annotations + } + serviceAccount = { + annotations = var.service_annotations + } + } + }) +} + resource "helm_release" "nginx_ingress" { name = "nginx-ingress" repository = "https://kubernetes.github.io/ingress-nginx" @@ -15,5 +27,5 @@ resource "helm_release" "nginx_ingress" { namespace = "ingress-nginx" create_namespace = true - values = [data.template_file.nginx_values.rendered] + 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 b27445a..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: - ${lb_annotations} + annotations: {} labels: networking/traffic-allowed: "yes" resources: @@ -53,8 +52,7 @@ controller: effect: "NoSchedule" serviceAccount: create: false - annotations: | - ${service_annotations} + annotations: {} defaultBackend: podLabels: networking/traffic-allowed: "yes"