Closed johncblandii closed 4 years ago
This specific use-case is to help DRY up code and make it a bit more readable inside of the job.
job "myjob" { option "value" { default = coalesce(list("")) description = "args to pass to subcommand" type = string } variable "valuesplit" { type = list(string) value = split(".", opt.value) } variable "cmd" { type = string value = var.valuesplit[0] } variable "project" { type = string value = var.valuesplit[1] } exec { command = "echo" args = "run ${var.cmd} inside directory ${var.project}" } }
This allows var.cmd to be used to in the exec vs:
var.cmd
args = "run ${var.valuesplit[0]} inside directory ${var.valuesplit[1]}"
This specific use-case is to help DRY up code and make it a bit more readable inside of the job.
This allows
var.cmd
to be used to in the exec vs: