Skip to content

Commit 445147e

Browse files
authored
chore: Interface edits and documentation updates (#8)
* Interface edits and documentation updates * Logging interface refactor
1 parent baacd30 commit 445147e

File tree

15 files changed

+576
-158
lines changed

15 files changed

+576
-158
lines changed

README.md

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,29 @@
22

33
[![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/DataDog/terraform-aws-lambda-datadog/blob/main/LICENSE)
44

5-
Use this Terraform module to install Datadog Monitoring for AWS Elastic Container Service tasks.
5+
Use this Terraform module to install Datadog monitoring for AWS Elastic Container Service tasks.
66

7-
This Terraform module wraps the [aws_ecs_task_definition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition) resource and automatically configures your task definition for Datadog Monitoring by:
7+
This Terraform module wraps the [aws_ecs_task_definition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition) resource and automatically configures your task definition for Datadog monitoring.
88

9-
* Adding the Datadog Agent container
10-
* Optionally, the Fluentbit log router
11-
* Optionally, the Cloud Workload Security tracer
12-
* Configuring application containers with necessary mounts and environment variables
13-
* Enabling the collection of metrics, traces, and logs to Datadog
9+
For more information on the ECS Fargate module, reference the [documentation](https://github.com/DataDog/terraform-ecs-datadog/blob/main/modules/ecs_fargate/README.md).
1410

1511
## Usage
1612

1713
```hcl
18-
module "ecs_task" {
14+
module "datadog_ecs_fargate_task" {
1915
source = "../../modules/ecs_fargate"
2016
2117
# Datadog Configuration
2218
dd_api_key_secret_arn = "arn:aws:secretsmanager:us-east-1:0000000000:secret:example-secret"
23-
dd_environment = [
24-
{
25-
name = "DD_TAGS",
26-
value = "team:cont-p, owner:container-monitoring"
27-
},
28-
]
19+
dd_tags = "team:cont-p, owner:container-monitoring"
2920
3021
# Task Configuration
3122
family = "example-app"
32-
container_definitions = {
33-
dogstatsd-app = {
23+
container_definitions = jsonencode([
24+
{
3425
name = "datadog-dogstatsd-app",
3526
image = "ghcr.io/datadog/apps-dogstatsd:main",
36-
essential = false,
37-
},
38-
apm-app = {
39-
name = "datadog-apm-app",
40-
image = "ghcr.io/datadog/apps-tracegen:main",
41-
essential = false,
4227
}
43-
}
28+
])
4429
}
4530
```

examples/ecs_fargate/main.tf

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed
2+
# under the Apache License Version 2.0.
3+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
# Copyright 2025-present Datadog, Inc.
5+
16
################################################################################
27
# Task Definition: Datadog Agent Example
38
################################################################################
49

5-
module "ecs_task" {
10+
module "datadog_ecs_fargate_task" {
611
source = "../../modules/ecs_fargate"
712

813
# Configure Datadog
@@ -16,8 +21,8 @@ module "ecs_task" {
1621

1722
dd_environment = [
1823
{
19-
name = "DD_CUSTOM_ENV_VAR",
20-
value = "custom_value",
24+
name = "DD_CUSTOM_FEATURE",
25+
value = "true",
2126
},
2227
]
2328

@@ -31,8 +36,10 @@ module "ecs_task" {
3136
}
3237

3338
dd_log_collection = {
34-
enabled = true,
35-
is_log_router_dependency_enabled = true,
39+
enabled = false,
40+
fluentbit_config = {
41+
is_log_router_dependency_enabled = true,
42+
}
3643
}
3744

3845
dd_cws = {
@@ -43,29 +50,35 @@ module "ecs_task" {
4350
family = "datadog-terraform-app"
4451
container_definitions = jsonencode([
4552
{
46-
name = "datadog-dogstatsd-app",
47-
image = "ghcr.io/datadog/apps-dogstatsd:main",
48-
essential = false,
53+
name = "datadog-dogstatsd-app",
54+
image = "ghcr.io/datadog/apps-dogstatsd:main",
55+
essential = false,
4956
},
5057
{
51-
name = "datadog-apm-app",
52-
image = "ghcr.io/datadog/apps-tracegen:main",
53-
essential = false,
58+
name = "datadog-apm-app",
59+
image = "ghcr.io/datadog/apps-tracegen:main",
60+
essential = true,
5461
},
5562
{
5663
name = "datadog-cws-app",
5764
image = "public.ecr.aws/ubuntu/ubuntu:22.04_stable",
58-
essential = true,
65+
essential = false,
5966
entryPoint = [
6067
"/usr/bin/bash",
6168
"-c",
6269
"cp /usr/bin/bash /tmp/malware; chmod u+s /tmp/malware; apt update;apt install -y curl wget; /tmp/malware -c 'while true; do wget https://google.com; sleep 60; done'"
6370
],
6471
}
6572
])
73+
volumes = [
74+
{
75+
name = "app-volume"
76+
}
77+
]
78+
inference_accelerator = null
6679
runtime_platform = {
67-
cpu_architecture = "ARM64",
68-
operating_system_family = "LINUX",
80+
cpu_architecture = "ARM64"
81+
operating_system_family = "LINUX"
6982
}
7083
requires_compatibilities = ["FARGATE"]
7184
}

examples/ecs_fargate/outputs.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed
2+
# under the Apache License Version 2.0.
3+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
# Copyright 2025-present Datadog, Inc.
5+
16
output "example_module" {
2-
value = module.ecs_task
7+
value = module.datadog_ecs_fargate_task.arn
38
}

examples/ecs_fargate/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed
2+
# under the Apache License Version 2.0.
3+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
# Copyright 2025-present Datadog, Inc.
5+
16
variable "dd_api_key" {
27
description = "Datadog API Key"
38
type = string

examples/ecs_fargate/versions.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed
2+
# under the Apache License Version 2.0.
3+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
# Copyright 2025-present Datadog, Inc.
5+
16
terraform {
27
required_version = ">= 1.5.0"
38

0 commit comments

Comments
 (0)