24 lines
562 B
HCL
24 lines
562 B
HCL
resource "nomad_job" "backups" {
|
|
jobspec = templatefile("${path.module}/backup.nomad", {
|
|
module_path = "${path.module}",
|
|
batch_node = null,
|
|
})
|
|
}
|
|
|
|
# Get Nomad clients from Consul
|
|
data "consul_service" "nomad" {
|
|
name = "nomad-client"
|
|
}
|
|
|
|
resource "nomad_job" "backups-oneoff" {
|
|
# TODO: Get list of nomad hosts dynamically
|
|
for_each = toset([
|
|
for node in data.consul_service.nomad.service :
|
|
node.node_name
|
|
])
|
|
jobspec = templatefile("${path.module}/backup.nomad", {
|
|
module_path = "${path.module}",
|
|
batch_node = each.key,
|
|
})
|
|
}
|