Hi!
Quite new to Nomad, and like it so far!
I have a question with regards to variable interpolation which I can’t really wrap my head around.
I’m trying to get docker containers spun up by Nomad to resolve towards local resolver running on host where container is placed (Unbound with stub-zone for consul DNS lookups for ~consul. domains, as well as forward-zones for upstream resolvers for everything else).
Trying to achieve this with something like below:
network {
mode = "bridge"
port "http" {
to = "xxxx"
}
port "gossip" {
to = "yyyy"
}
dns {
servers = ["${attr.unique.network.ip-address}"]
}
}
The network stanza lives in the “group” layer of the job atm. I’d imagine that the the above
"${attr.unique.network.ip-address}"
would resolve to the host IP, but it actually never gets evaluated and /etc/resolv.conf will contain "${attr.unique.network.ip-address}"
instead of resolved IP.
I’ve tried some different formats from Variable Interpolation | Nomad by HashiCorp, such as the {{ env “attr.unique.network.ip-address” }} but then run into syntax errors.
Would be awesome if someone could point to where I’m failing, if it’s syntax related or just not meant to be used like this.
Thanks for a great product!
Cheers
E