homelab-nomad/metrics/metrics.tf

40 lines
768 B
Terraform
Raw Normal View History

variable "consul_address" {
type = string
description = "address of consul server for dynamic scraping"
}
# resource "nomad_job" "exporters" {
# hcl2 {
# enabled = true
# }
#
# jobspec = file("${path.module}/exporters.nomad")
# }
2022-03-13 17:13:19 +00:00
data "consul_nodes" "all-nodes" {
query_options {
datacenter = "dc1"
}
}
resource "nomad_job" "prometheus" {
hcl2 {
enabled = true
vars = {
2022-03-13 17:13:19 +00:00
# "consul_address" = "${var.consul_address}",
# TODO: Should this be a list?
"consul_address" = "http://${data.consul_nodes.all-nodes.nodes[0].address}:8500",
}
}
jobspec = file("${path.module}/prometheus.nomad")
}
resource "nomad_job" "grafana" {
hcl2 {
enabled = true
}
jobspec = file("${path.module}/grafana.nomad")
}