variable "region" { type = string } variable "node_dcs" { type = list(string) } variable "controller_dcs" { type = list(string) default = null } terraform { required_providers { nomad = {} } } resource "nomad_job" "nfs-controller" { jobspec = file("${path.module}/controller.hcl") hcl2 { enabled = true vars = { "region" = var.region "datacenters" = jsonencode(var.controller_dcs == null ? var.node_dcs : var.controller_dcs) } } } resource "nomad_job" "nfs-node" { jobspec = file("${path.module}/node.hcl") hcl2 { enabled = true vars = { "region" = var.region "datacenters" = jsonencode(var.node_dcs) } } }