Dynamically add dns routes to traefik instances to blocky

This commit is contained in:
IamTheFij 2022-05-19 16:53:56 -07:00
parent 719c1b62d1
commit 38597a7eda
2 changed files with 8 additions and 4 deletions

View File

@ -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",
}
)
}

View File

@ -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