feat(job): add option to pass in variables to job using the job_variables variable

This commit is contained in:
Bertrand Lanson 2024-02-24 23:26:12 +01:00
parent 1557619a6d
commit b6988ce53f
2 changed files with 7 additions and 0 deletions

View File

@ -12,6 +12,7 @@ resource "nomad_job" "this" {
purge_on_destroy = true
hcl2 {
allow_fs = true
vars = contains(keys(var.jobs_variables), each.key) ? jobs_variables[each.key] : {}
}
}

View File

@ -5,6 +5,12 @@ variable "jobs" {
default = {}
}
variable "jobs_variables" {
type = map(object({}))
default = {}
description = "Map of object to pass variables to the nomad job(s). Key is the job's name, value is a map of variables and their values"
}
variable "volumes" {
type = map(object({
plugin_id = string