From 6854347d3319fc43ca1324f8d16dc2af8a4e85f6 Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Tue, 8 Oct 2024 10:09:17 -0700 Subject: [PATCH] Split out core metrics --- core/exporters.tf | 5 +++++ core/{metrics.tf => grafana.tf} | 26 ++++++++++++-------------- core/prometheus.tf | 7 +++++++ 3 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 core/exporters.tf rename core/{metrics.tf => grafana.tf} (83%) create mode 100644 core/prometheus.tf diff --git a/core/exporters.tf b/core/exporters.tf new file mode 100644 index 0000000..8025bae --- /dev/null +++ b/core/exporters.tf @@ -0,0 +1,5 @@ +resource "nomad_job" "exporters" { + jobspec = templatefile("${path.module}/exporters.nomad", { + use_wesher = var.use_wesher, + }) +} diff --git a/core/metrics.tf b/core/grafana.tf similarity index 83% rename from core/metrics.tf rename to core/grafana.tf index 1265f53..5252dd5 100644 --- a/core/metrics.tf +++ b/core/grafana.tf @@ -1,17 +1,3 @@ -resource "nomad_job" "exporters" { - jobspec = templatefile("${path.module}/exporters.nomad", { - use_wesher = var.use_wesher, - }) -} - -resource "nomad_job" "prometheus" { - jobspec = templatefile("${path.module}/prometheus.nomad", { - use_wesher = var.use_wesher, - }) - - detach = false -} - resource "nomad_job" "grafana" { jobspec = templatefile("${path.module}/grafana.nomad", { module_path = path.module @@ -117,3 +103,15 @@ module "grafana_oidc" { task = "grafana" } } + +# resource "nomad_variable" "grafana_config" { +# for_each = fileset("${path.module}/grafana", "**") +# +# path = "nomad/jobs/grafana/${replace(each.key, ".", "_")}" +# items = { +# path = "${each.key}" +# value = file("${path.module}/grafana/${each.key}") +# left_delimiter = endswith(each.key, ".json") ? "<<<<" : "{{" +# right_delimiter = endswith(each.key, ".json") ? ">>>>" : "}}" +# } +# } diff --git a/core/prometheus.tf b/core/prometheus.tf new file mode 100644 index 0000000..323a017 --- /dev/null +++ b/core/prometheus.tf @@ -0,0 +1,7 @@ +resource "nomad_job" "prometheus" { + jobspec = templatefile("${path.module}/prometheus.nomad", { + use_wesher = var.use_wesher, + }) + + detach = false +}