Dynamic nomad job name

Hi there,

I have written a nomad job to run. I have to automatically create new jobs and so I was wondering if there is a possibility to just use the same nomad job file but just dynamically change the jobname.

The nomad job I have written is this:

variable "templateName" {
  type = string
}
variable "userName" {
  type = string
}
variable "courseName" {
  type = string
}

job "testjob" {
  datacenters = ["dc1"]
  type = "batch"
  group "testgroup" {
    task "testtask" {
      driver = "raw_exec"
      config {
        command = "bash"
        args = ["/home/t/eduvirt-cloud/web-backend/nomad/script.sh","${var.templateName}", "${var.userName}", "${var.courseName}"]
      }
    }
  }
}

So I want to dynamically change this testjob parameter to what my templateName is combined with the userName.

Thanks in advance!

1 Like

Unfortunately it looks like that’s not possible (other discuss topic with the same question) but there is an issue open for it and the Nomad team is aware of it.