From 305aae8027f3146082fb4664e67ebe05f1a061bf Mon Sep 17 00:00:00 2001 From: Dhrubajyoti Sadhu Date: Wed, 13 Dec 2023 01:25:26 +0530 Subject: [PATCH] Added the required files --- common.tf | 13 +++++++++++ templates/apiary-hms-readonly.json | 35 +++++++++++++++++++++++++++++- variables.tf | 6 +++++ version.tf | 4 ++++ 4 files changed, 57 insertions(+), 1 deletion(-) diff --git a/common.tf b/common.tf index 63e22d7..588a0c7 100644 --- a/common.tf +++ b/common.tf @@ -78,3 +78,16 @@ data "aws_route53_zone" "apiary_zone" { name = var.apiary_domain_name vpc_id = var.vpc_id } + +data "aws_secretsmanager_secret" "datadog_key" { + name = var.datadog_key_secret_name +} + +data "aws_secretsmanager_secret_version" "datadog_key" { + secret_id = data.aws_secretsmanager_secret.datadog_key.id +} + +provider "datadog" { + api_key = jsondecode(data.aws_secretsmanager_secret_version.datadog_key.secret_string).api_key + app_key = jsondecode(data.aws_secretsmanager_secret_version.datadog_key.secret_string).app_key +} diff --git a/templates/apiary-hms-readonly.json b/templates/apiary-hms-readonly.json index df313cf..339627b 100644 --- a/templates/apiary-hms-readonly.json +++ b/templates/apiary-hms-readonly.json @@ -178,5 +178,38 @@ } %{ endfor } ] - } + }, + { + "name": "datadog-agent", + "image": "public.ecr.aws/datadog/agent:latest", + "essential": true, + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-group": "${loggroup}", + "awslogs-region": "${region}", + "awslogs-stream-prefix": "/" + } + }, + "environment": [ + { + "name": "DD_API_KEY", + "value": "${datadog_secret_key}" + }, + { + "name": "ECS_FARGATE", + "value": "true" + } + ], + "healthCheck": { + "command": [ + "CMD-SHELL", + "curl -f http://localhost:18000/actuator/health || exit 1" + ], + "interval": 5, + "retries": 3, + "startPeriod": 60, + "timeout": 5 + } + } ] diff --git a/variables.tf b/variables.tf index f6de153..f627e53 100644 --- a/variables.tf +++ b/variables.tf @@ -715,3 +715,9 @@ variable "hms_ro_request_partition_limit" { type = string default = "" } + +variable "datadog_key_secret_name" { + description = "SecretsManager secret name containing a DataDog API key" + type = string + default = "dd-analytics-platform-starburst" +} diff --git a/version.tf b/version.tf index bc30dbe..986dc2d 100644 --- a/version.tf +++ b/version.tf @@ -15,5 +15,9 @@ terraform { source = "hashicorp/aws" version = "~> 4.0" } + datadog = { + source = "DataDog/datadog" + version = "~> 3.25.0" + } } }