From 06428507371992d81678b58c8230c98c410530a9 Mon Sep 17 00:00:00 2001 From: Eddy Decena Date: Wed, 8 May 2024 06:27:23 -0400 Subject: [PATCH] fix: Add tags to Datadog agent --- CHANGELOG.md | 3 +++ ecs.tf | 2 ++ templates.tf | 2 ++ templates/datadog-agent.json | 4 ++++ 4 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dac8528..c28e9e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [4.5.1] - 2024-05-08 +### Added +- Adding tags to the Datadog agent ## [4.5.0] - 2024-04-25 ### Added diff --git a/ecs.tf b/ecs.tf index 1d4ab6d..4b84ac9 100644 --- a/ecs.tf +++ b/ecs.tf @@ -18,6 +18,8 @@ resource "aws_ecs_service" "waggledance_service" { task_definition = aws_ecs_task_definition.waggledance[0].arn desired_count = var.wd_ecs_task_count + platform_version = "1.4.0" + propagate_tags = "SERVICE" tags = var.tags diff --git a/templates.tf b/templates.tf index 7cae0d3..abf678c 100644 --- a/templates.tf +++ b/templates.tf @@ -7,6 +7,7 @@ locals { default_exposed_endpoints = "health,info,metrics" exposed_endpoints = var.prometheus_enabled ? join(",", [local.default_exposed_endpoints, "prometheus"]) : local.default_exposed_endpoints + datadog_tags = join(" ", formatlist("%s:%s", keys(var.tags), values(var.tags))) } data "template_file" "endpoints_server_yaml" { @@ -206,5 +207,6 @@ data "template_file" "datadog-agent" { wd_instance_type = var.wd_instance_type metrics_port = var.metrics_port datadog_agent_version = var.datadog_agent_version + datadog_tags = local.datadog_tags } } diff --git a/templates/datadog-agent.json b/templates/datadog-agent.json index d2f49fb..9ee8386 100644 --- a/templates/datadog-agent.json +++ b/templates/datadog-agent.json @@ -19,6 +19,10 @@ { "name": "ECS_FARGATE", "value": "true" + }, + { + "name": "DD_TAGS", + "value": "${datadog_tags}" } ], "healthCheck": {