nomad
nomad copied to clipboard
Can't use variables or locals on block labels
Nomad version
Nomad v1.0.0-rc1 (afea734825ebaade422bbf2d31364abff6def928)
Operating system and Environment details
Ubuntu 20.04.1 LTS
Issue
I was trying to use locals/vars to customize the name of a job, following the example in the docs but I'm getting this error:
Error getting job struct: Error parsing job file from locals-bug.nomad:
locals-bug.nomad:10,6-8: Invalid string literal; Template sequences are not allowed in this string. To include a literal "$", double it (as "$$") to escape it., and 2 other diagnostic(s)
Reproduction steps
- Define variables and/or locals in a job file
- Try to interpolate any variable and/or locals on the job name label.
Job file (if appropriate)
variables {
name = "app"
suffix = "cluster"
}
locals {
job_name = "${var.name}_${var.suffix}"
}
job "${local.job_name}" {
datacenters = [ "FSN" ]
group "app-nodes" {
count = 3
task "app-node" {
driver = "docker"
config {
network_mode = "host"
image = "hello-world:latest"
}
}
}
}