diff --git a/nomad/blocky/blocky.tf b/nomad/blocky/blocky.tf index 9d1246f..9765d7e 100644 --- a/nomad/blocky/blocky.tf +++ b/nomad/blocky/blocky.tf @@ -9,9 +9,6 @@ locals { "${path.module}/config.yml", { "base_hostname" = "${var.base_hostname}", - # Could get this from consul_service.traefik - # but not sure what happens if it doens't exist yet - "ingress_address" = "192.168.2.106", } ) } diff --git a/nomad/blocky/config.yml b/nomad/blocky/config.yml index 6ad87e9..98af1c3 100644 --- a/nomad/blocky/config.yml +++ b/nomad/blocky/config.yml @@ -25,7 +25,14 @@ blocking: customDNS: customTTL: 1h mapping: - ${base_hostname}: ${ingress_address} + {{ with service "traefik" -}} + {{- $last := len . | subtract 1 -}} + {{- $services := . -}} + ${base_hostname}: {{ range $i := loop $last -}} + {{- with index $services $i }}{{ .Address }},{{ end -}} + {{- end -}} + {{- with index . $last }}{{ .Address }}{{ end -}} + {{- end }} prometheus: enable: true