Nomad Runtime environment and value interpolation failed to load environment value

1.4k views Asked by At

I was creating a Nomad job for airflow worker node using docker driver and trying to read from the env about the IP address or hostname of the current nomad client.

I first tried in task template, HOST_NAME="{{ env "attr.unique.hostname" }}" works fine and I can print out the correct host name in log.

However, when I try to fill in the config parameter such as hostname (https://www.nomadproject.io/docs/drivers/docker.html#hostname) using variable interpolation (https://www.nomadproject.io/docs/runtime/interpolation), such as hostname = ${attr.unique.hostname} I got such complaint during terraform deployment

Invalid value for "vars" parameter: vars map does not contain key "attr",

I also tried runtime environment (https://www.nomadproject.io/docs/runtime/environment) and fill in the config parameter such as ipv4_address = "$NOMAD_IP_<label>:$NOMAD_HOST_PORT_<label>" (https://www.nomadproject.io/docs/drivers/docker.html#ipv4_address). It failed to pass in the right value either.

0

There are 0 answers