Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions modules/chart_ingress_nginx/main.tf
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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]
}
6 changes: 2 additions & 4 deletions modules/chart_ingress_nginx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ controller:
ports:
http: 80
https: 443
annotations:
${lb_annotations}
annotations: {}
labels:
networking/traffic-allowed: "yes"
resources:
Expand Down Expand Up @@ -53,8 +52,7 @@ controller:
effect: "NoSchedule"
serviceAccount:
create: false
annotations: |
${service_annotations}
annotations: {}
defaultBackend:
podLabels:
networking/traffic-allowed: "yes"
Expand Down