2022-05-18 21:23:28 +00:00
|
|
|
resource "nomad_job" "backups" {
|
2022-07-28 00:02:29 +00:00
|
|
|
jobspec = templatefile("${path.module}/backup.nomad", {
|
|
|
|
module_path = "${path.module}",
|
|
|
|
batch_node = null,
|
|
|
|
})
|
2022-05-18 21:23:28 +00:00
|
|
|
}
|
|
|
|
|
2022-10-27 21:28:34 +00:00
|
|
|
# Get Nomad clients from Consul
|
2022-10-31 22:27:29 +00:00
|
|
|
# data "consul_service" "nomad" {
|
|
|
|
# name = "nomad-client"
|
|
|
|
# }
|
2022-10-27 21:28:34 +00:00
|
|
|
|
2022-05-18 21:23:28 +00:00
|
|
|
resource "nomad_job" "backups-oneoff" {
|
2022-10-27 21:28:34 +00:00
|
|
|
# TODO: Get list of nomad hosts dynamically
|
2022-10-31 22:21:25 +00:00
|
|
|
for_each = toset(["n1", "n2"])
|
|
|
|
# for_each = toset([
|
|
|
|
# for node in data.consul_service.nomad.service :
|
|
|
|
# node.node_name
|
|
|
|
# ])
|
2022-07-28 00:02:29 +00:00
|
|
|
jobspec = templatefile("${path.module}/backup.nomad", {
|
|
|
|
module_path = "${path.module}",
|
|
|
|
batch_node = each.key,
|
|
|
|
})
|
2022-05-18 21:23:28 +00:00
|
|
|
}
|