Promethus: Use env for consul address rather than variable

This commit is contained in:
IamTheFij 2022-07-25 10:38:48 -07:00
parent 1c02e69225
commit 1e35958044
2 changed files with 11 additions and 5 deletions

View File

@ -21,6 +21,7 @@ resource "nomad_job" "prometheus" {
hcl2 { hcl2 {
enabled = true enabled = true
vars = { vars = {
# TODO: May not need this because we have an env variable for that
# "consul_address" = "${var.consul_address}", # "consul_address" = "${var.consul_address}",
# TODO: Should this be a list? # TODO: Should this be a list?
"consul_address" = "http://${data.consul_nodes.all-nodes.nodes[0].address}:8500", "consul_address" = "http://${data.consul_nodes.all-nodes.nodes[0].address}:8500",

View File

@ -97,7 +97,8 @@ scrape_configs:
format: format:
- "prometheus" - "prometheus"
consul_sd_configs: consul_sd_configs:
- server: "${var.consul_address}" # - server: "${var.consul_address}"
- server: "${CONSUL_HTTP_ADDR}"
services: services:
- "nomad" - "nomad"
tags: tags:
@ -109,7 +110,8 @@ scrape_configs:
format: format:
- "prometheus" - "prometheus"
consul_sd_configs: consul_sd_configs:
- server: "${var.consul_address}" # - server: "${var.consul_address}"
- server: "${CONSUL_HTTP_ADDR}"
services: services:
- "nomad-client" - "nomad-client"
@ -119,7 +121,8 @@ scrape_configs:
format: format:
- "prometheus" - "prometheus"
consul_sd_configs: consul_sd_configs:
- server: "${var.consul_address}" # - server: "${var.consul_address}"
- server: "${CONSUL_HTTP_ADDR}"
services: services:
- "consul" - "consul"
relabel_configs: relabel_configs:
@ -130,7 +133,8 @@ scrape_configs:
- job_name: "exporters" - job_name: "exporters"
metrics_path: "/metrics" metrics_path: "/metrics"
consul_sd_configs: consul_sd_configs:
- server: "${var.consul_address}" # - server: "${var.consul_address}"
- server: "${CONSUL_HTTP_ADDR}"
relabel_configs: relabel_configs:
- source_labels: [__meta_consul_service] - source_labels: [__meta_consul_service]
action: drop action: drop
@ -152,7 +156,8 @@ scrape_configs:
- job_name: "envoy" - job_name: "envoy"
metrics_path: "/metrics" metrics_path: "/metrics"
consul_sd_configs: consul_sd_configs:
- server: "${var.consul_address}" # - server: "${var.consul_address}"
- server: "${CONSUL_HTTP_ADDR}"
relabel_configs: relabel_configs:
- source_labels: [__meta_consul_service] - source_labels: [__meta_consul_service]
action: keep action: keep