From f75baaf609ee35f30bd7c1050c5d2d0ba295e4b5 Mon Sep 17 00:00:00 2001 From: Tomas Valenta Date: Mon, 25 Mar 2024 16:11:21 -0700 Subject: [PATCH] Use consul token for scraping metrics --- packages/nomad/main.tf | 2 ++ packages/nomad/otel-collector.hcl | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/packages/nomad/main.tf b/packages/nomad/main.tf index 7b88af2e1..8d069e4ea 100644 --- a/packages/nomad/main.tf +++ b/packages/nomad/main.tf @@ -149,6 +149,8 @@ resource "nomad_job" "otel-collector" { grafana_api_key = data.google_secret_manager_secret_version.grafana_api_key.secret_data + consul_token = var.consul_acl_token_secret + gcp_zone = var.gcp_zone } } diff --git a/packages/nomad/otel-collector.hcl b/packages/nomad/otel-collector.hcl index a0b950615..4b4705002 100644 --- a/packages/nomad/otel-collector.hcl +++ b/packages/nomad/otel-collector.hcl @@ -30,6 +30,10 @@ variable "grafana_metrics_endpoint" { type = string } +variable "consul_token" { + type = string +} + variables { otel_image = "otel/opentelemetry-collector-contrib:0.90.1" } @@ -122,6 +126,7 @@ receivers: format: ['prometheus'] consul_sd_configs: - services: ['nomad-client', 'nomad', 'api', 'client-proxy', 'session-proxy', 'otel-collector', 'logs-collector', 'docker-reverse-proxy'] + token: "${var.consul_token}" relabel_configs: - source_labels: ['__meta_consul_tags']