Problem with Waypoint and Nomad jobspec variable interpolation?

Hello,

I have been experimenting with Waypoint lately, and I noticed if I specify the following deploy stanza in my waypoint.hcl:

  deploy {
    use "nomad-jobspec" {
      jobspec = templatefile("${path.app}/nomad.hcl")
    }
  }

And then I have a nomad.hcl that looks something like this:

job "my-job" {
  datacenters = ["somewhere"]
  type = "service"

  [ ... ]

  group "my-job-group" {
    constraint {
      attribute = "${node.unique.name}"
      operator  = "="
      value     = "my-specific-node"
    }
    [ ... ]
  }
  [ ... ]
}

When I go to deploy my app, I will get this error from Waypoint:

» Building...
[ ... ]

» Deploying...
[ ... ]

» Deploying...
! /path/to/waypoint.hcl:24,33-41:
  Invalid function argument; Invalid value for "template_path" parameter: template
  refers to variable "node" at
  /path/to/nomad.hcl:16,22-26,
  but this call has no vars map., and 1 other diagnostic(s)

Is there some way I can tell Waypoint to ignore the nomad-specific vars in the Nomad job spec file?

–Kyle

hello Kyle, I have same probleme you described . Do you fixed it ?

I just find origin of the problem.

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

Transform

attribute = “${node.unique.name}”

attribute = “$${node.unique.name}”

2 Likes