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 {
enabled = true
vars = {
# TODO: May not need this because we have an env variable for that
# "consul_address" = "${var.consul_address}",
# TODO: Should this be a list?
"consul_address" = "http://${data.consul_nodes.all-nodes.nodes[0].address}:8500",

View File

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