diff --git a/main.tf b/main.tf index 4e2b9a5..0d08b95 100644 --- a/main.tf +++ b/main.tf @@ -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] : {} } } diff --git a/variables.tf b/variables.tf index d1ba18f..948b738 100644 --- a/variables.tf +++ b/variables.tf @@ -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