How can i use nomad config env (${NOMAD_PORT_http}, ${NOMAD_IP_http} )

when i try to used in my nomad job template during the waypoint deploiment some error blocked the flow.

Invalid function argument; Invalid value for “template_path” parameter: template refers to variable “NOMAD_PORT_http” at app.nomad.tpl

but this call has no vars map

my app.nomad.tpl
task “hello-microservice-deploy” {
env {
PORT = “${NOMAD_PORT_http}”
NODE_IP = “${NOMAD_IP_http}”

  driver = "docker"

  config {
    image = "${artifact.image}:${artifact.tag}"
    ports = ["http"]
  resources {
    cpu    = 100  // default 100 MHz
    memory = 128  // default 300 MB

to launch my service

const PORT = process.env.PORT
.listen(PORT, () => console.log(Listening on ${ PORT }))

do you have any idea, how i can do it to work ?

i follow the tutorial load-balancing-traefik

Hi @Yamesou, The issue is that there is a 2 layers of templating and the templating you want here should be evaluated by nomad itself, rather than waypoint.

You should be able to escape the templating that you want waypoint to not see by using a $$. For example, from the terraform docs on HCL:

You can escape interpolation with double dollar signs: $${foo} will be rendered as a literal ${foo} .

1 Like