Build traefik static config better when services aren't found

This commit is contained in:
IamTheFij 2022-04-15 12:13:00 -07:00
parent 456485aa5e
commit aeb662d799

View File

@ -149,24 +149,30 @@ job "traefik" {
rule = "Host(`vault.${var.base_hostname}`)"
[http.services]
<< with service "nomad-client" ->>
[http.services.nomad]
[http.services.nomad.loadBalancer]
<< range service "nomad-client" >>
<< range . ->>
[[http.services.nomad.loadBalancer.servers]]
url = "http://<< .Address >>:<< .Port >>"
<< end >>
<<- end >>
<< with service "consul" ->>
[http.services.consul]
[http.services.consul.loadBalancer]
<< range service "consul" >>
<< range . ->>
[[http.services.consul.loadBalancer.servers]]
url = "http://<< .Address >>:<< .Port >>"
<< end >>
<<- end >>
<< with service "vault" ->>
[http.services.vault]
[http.services.vault.loadBalancer]
<< range service "vault" >>
<< range . ->>
[[http.services.vault.loadBalancer.servers]]
url = "http://<< .Address >>:<< .Port >>"
<< end >>
<<- end >>
EOH
destination = "/config/conf/route-hashi.toml"
change_mode = "noop"