From a2e70778893301e0331dc0c88d0024a03f7f2ed5 Mon Sep 17 00:00:00 2001 From: janli Date: Tue, 19 Nov 2024 11:20:51 -0800 Subject: [PATCH] fix: fxing syntax --- common.tf | 2 ++ templates.tf | 10 +++++++--- templates/apiary-hms-readonly.json | 2 +- templates/apiary-hms-readwrite.json | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/common.tf b/common.tf index 40342cf..a12b717 100644 --- a/common.tf +++ b/common.tf @@ -64,6 +64,8 @@ locals { ro_ingress_cidr = var.ingress_cidr rw_ingress_cidr = length(var.rw_ingress_cidr) == 0 ? var.ingress_cidr : var.rw_ingress_cidr + hms_metrics = join("\",\"", var.datadog_metrics_hms_readwrite_readonly) + hms_metrics_type_overrides = join("\": \"gauge\",\"", var.datadog_metrics_hms_readwrite_readonly) } data "aws_iam_account_alias" "current" {} diff --git a/templates.tf b/templates.tf index e381a42..e677505 100644 --- a/templates.tf +++ b/templates.tf @@ -71,9 +71,11 @@ locals{ datadog_agent_version = var.datadog_agent_version datadog_agent_enabled = var.datadog_agent_enabled datadog_tags = local.datadog_tags - tcp_keepalive_time = var.tcp_keepalive_time - tcp_keepalive_intvl = var.tcp_keepalive_intvl - tcp_keepalive_probes = var.tcp_keepalive_probes + tcp_keepalive_time = var.tcp_keepalive_time + tcp_keepalive_intvl = var.tcp_keepalive_intvl + tcp_keepalive_probes = var.tcp_keepalive_probes + hms_metrics = local.hms_metrics + hms_metrics_type_overrides = local.hms_metrics_type_overrides }) hms_readonly_template = templatefile("${path.module}/templates/apiary-hms-readonly.json", { @@ -131,5 +133,7 @@ locals{ hms_readwrite_namespace = var.hms_readwrite_namespace hms_readonly_namespace = var.hms_readonly_namespace datadog_metrics_hms_readwrite_readonly = var.datadog_metrics_hms_readwrite_readonly + hms_metrics = local.hms_metrics + hms_metrics_type_overrides = local.hms_metrics_type_overrides }) } diff --git a/templates/apiary-hms-readonly.json b/templates/apiary-hms-readonly.json index f864fe1..d86c6b5 100644 --- a/templates/apiary-hms-readonly.json +++ b/templates/apiary-hms-readonly.json @@ -75,7 +75,7 @@ } }, "dockerLabels": { - "com.datadoghq.ad.instances": "[{ \"prometheus_url\": \"http://%%host%%:8080/actuator/prometheus\", \"namespace\": \"${hms_readonly_namespace}\", \"metrics\": [${join(\",\", ${datadog_metrics_hms_readwrite_readonly} )}] }]" + "com.datadoghq.ad.instances": "[{ \"prometheus_url\": \"http://%%host%%:8080/actuator/prometheus\", \"namespace\": \"${hms_readonly_namespace}\", \"metrics\": [\"${hms_metrics}\"],\"type_overrides\":{\"${hms_metrics_type_overrides}\": \"gauge\"} }]", "com.datadoghq.ad.check_names": "[\"prometheus\"]", "com.datadoghq.ad.init_configs": "[{}]" }, diff --git a/templates/apiary-hms-readwrite.json b/templates/apiary-hms-readwrite.json index 87ec74a..ae04d48 100644 --- a/templates/apiary-hms-readwrite.json +++ b/templates/apiary-hms-readwrite.json @@ -75,7 +75,7 @@ } }, "dockerLabels": { - "com.datadoghq.ad.instances": "[{ \"prometheus_url\": \"http://%%host%%:8080/actuator/prometheus\", \"namespace\": \"${hms_readwrite_namespace}\", \"metrics\": [${join(\",\", var.datadog_metrics_hms_readwrite_readonly)}] }]" + "com.datadoghq.ad.instances": "[{ \"prometheus_url\": \"http://%%host%%:8080/actuator/prometheus\", \"namespace\": \"${hms_readwrite_namespace}\", \"metrics\": [\"${hms_metrics}\"],\"type_overrides\":{\"${hms_metrics_type_overrides}\": \"gauge\"} }]", "com.datadoghq.ad.check_names": "[\"prometheus\"]", "com.datadoghq.ad.init_configs": "[{}]" },