diff --git a/common.tf b/common.tf index 00d6515..c356c1e 100644 --- a/common.tf +++ b/common.tf @@ -61,11 +61,3 @@ 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 } - -output "datadog_api_key" { - value = jsondecode(data.aws_secretsmanager_secret_version.datadog_key.secret_string).api_key -} - -output "datadog_app_key" { - value = jsondecode(data.aws_secretsmanager_secret_version.datadog_key.secret_string).app_key -} \ No newline at end of file diff --git a/templates.tf b/templates.tf index 4c7543b..84d7206 100644 --- a/templates.tf +++ b/templates.tf @@ -190,5 +190,6 @@ data "template_file" "waggledance" { wd_instance_type = var.wd_instance_type datadog_metrics_port = var.datadog_metrics_port datadog_agent_version = var.datadog_agent_version + include_datadog_agent = var.include_datadog_agent } } diff --git a/templates/waggledance.json b/templates/waggledance.json index 50edf0c..9df1d1f 100644 --- a/templates/waggledance.json +++ b/templates/waggledance.json @@ -1,100 +1,101 @@ [ - { - "name": "waggledance", - "image": "${docker_image}:${docker_version}", - ${docker_auth} + { + "name": "waggledance", + "image": "${docker_image}:${docker_version}", + ${docker_auth} "essential": true, "logConfiguration": { - "logDriver": "awslogs", - "options": { + "logDriver": "awslogs", + "options": { "awslogs-group": "${loggroup}", "awslogs-region": "${region}", "awslogs-stream-prefix": "/" - } - }, + } +}, "dockerLabels": { "com.datadoghq.ad.instances": "[{\"openmetrics_endpoint\": \"http://%%host%%:${datadog_metrics_port}/actuator/prometheus\", \"namespace\": \"waggledance\", \"metrics\": [\"metastore_status\",\"counter_*\",\"jvm_*\",\"system_*\",\"timer_*\",\"http_*\",\"process_*\"], \"tags\": { \"region\":\"${region}\", \"instance_type\":\"${wd_instance_type}\"} }]", "com.datadoghq.ad.check_names": "[\"openmetrics\"]", "com.datadoghq.ad.init_configs": "[{}]" - }, +}, "portMappings": [ - { + { "containerPort": 48869, "hostPort": 48869 - } - ], + } +], "environment":[ - { + { "name": "HEAPSIZE", "value": "${heapsize}" - }, - { + }, + { "name": "LOGLEVEL", "value": "${loglevel}" - }, - { + }, + { "name": "INVOCATIONLOGLEVEL", "value": "${invocationloglevel}" - }, - { + }, + { "name": "SERVER_YAML", "value": "${server_yaml}" - }, - { + }, + { "name": "FEDERATION_YAML", "value": "${federation_yaml}" - }, - { + }, + { "name": "HIVE_SITE_XML", "value": "${hive_site_xml}" - }, - { + }, + { "name": "BASTION_SSH_KEY_ARN", "value": "${bastion_ssh_key_arn}" - }, - { + }, + { "name": "LOG4J_FORMAT_MSG_NO_LOOKUPS", "value": "true" - }, + }, { "name": "DD_USE_DOGSTATSD", "value": "true" } - ], +], "healthCheck": { - "command": ["CMD-SHELL", "curl -f http://localhost:18000/actuator/health || exit 1"], - "interval": 5, - "retries": 3, - "startPeriod": 60, - "timeout": 5 - }, + "command": ["CMD-SHELL", "curl -f http://localhost:${datadog_metrics_port}/actuator/health || exit 1"], + "interval": 5, + "retries": 3, + "startPeriod": 60, + "timeout": 5 +}, "ulimits": [ - { + { "name": "nofile", "softLimit": 65536, "hardLimit": 65536 - }, - { + }, + { "name": "nproc", "softLimit": 65536, "hardLimit": 65536 - } - ], + } +], "systemControls": [ - { - "namespace": "net.ipv4.tcp_keepalive_time", - "value": "${tcp_keepalive_time}" - }, - { - "namespace": "net.ipv4.tcp_keepalive_intvl", - "value": "${tcp_keepalive_intvl}" - }, - { - "namespace": "net.ipv4.tcp_keepalive_probes", - "value": "${tcp_keepalive_probes}" - } - ] - }, + { + "namespace": "net.ipv4.tcp_keepalive_time", + "value": "${tcp_keepalive_time}" + }, + { + "namespace": "net.ipv4.tcp_keepalive_intvl", + "value": "${tcp_keepalive_intvl}" + }, + { + "namespace": "net.ipv4.tcp_keepalive_probes", + "value": "${tcp_keepalive_probes}" + } +] + }, + ${include_datadog_agent ? { "name": "datadog-agent", "image": "public.ecr.aws/datadog/agent:${datadog_agent_version}", @@ -118,11 +119,15 @@ } ], "healthCheck": { - "command": ["CMD-SHELL", "curl -f http://localhost:18000/actuator/health || exit 1"], + "command": [ + "CMD-SHELL", + "curl -f http://localhost:${datadog_metrics_port}/actuator/health || exit 1" + ], "interval": 5, "retries": 3, "startPeriod": 60, "timeout": 5 } + } : null } ] diff --git a/variables.tf b/variables.tf index c8ff3fe..51fa263 100644 --- a/variables.tf +++ b/variables.tf @@ -389,3 +389,9 @@ variable "datadog_agent_version" { type = string default = "7.46.0-jmx" } + +variable "include_datadog_agent" { + description = "Whether to include the datadog-agent container" + type = bool + default = true +}