You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add support for OpenTelemetry and Datadog sidecars in ECS module (#44)
- Introduced new example for X-Ray tracing with OpenTelemetry.
- Added provider configuration for AWS in the new example.
- Created variables for OpenTelemetry and Datadog configurations.
- Updated main module to include sidecar configurations for Datadog and OpenTelemetry.
- Refactored container definitions to support sidecar dependencies.
- Removed legacy container definitions and replaced with modular definitions for server, drain, scheduler, and VCS gateway.
- Enhanced secrets management to include Datadog API key and OpenTelemetry configuration content.
- Updated IAM and secrets management to accommodate new sidecar configurations.
- Improved documentation and variable descriptions for clarity.
Copy file name to clipboardExpand all lines: README.md
+75-8Lines changed: 75 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,73 @@ This module creates an ECS cluster with all the necessary resources to run Space
4
4
5
5
This module is closely tied to the [terraform-aws-spacelift-selfhosted](https://github.com/spacelift-io/terraform-aws-spacelift-selfhosted) module, which contains the necessary surrounding infrastructure.
6
6
7
+
> [!IMPORTANT]
8
+
> ## 🔄 Upgrading to v2.0.0 - New features and breaking changes
9
+
>
10
+
> Click below to see the full upgrade guide with breaking changes and new features.
11
+
12
+
<details>
13
+
<summary><h3>📋 Full v2.0.0 Upgrade Guide</h3></summary>
14
+
15
+
<br>
16
+
17
+
Version 2.0.0 adds observability features and simplifies secret management. A few variables have been removed - see below for details.
18
+
19
+
### ✨ New Features
20
+
21
+
**Improved Secret Handling**
22
+
- License token is now protected from state file exposure using write-only attributes
23
+
- Secrets are automatically versioned when changed - no manual tracking needed (`license_token_wo_version` removed)
24
+
25
+
**Observability & Tracing Support**
26
+
27
+
This module now supports **Datadog** and **OpenTelemetry (OTEL)** sidecar containers for comprehensive application tracing and metrics:
28
+
-**Datadog**: Full APM support with the Datadog agent sidecar
29
+
-**OpenTelemetry**: Flexible OTEL collector sidecar that can be fully customized or configured for AWS X-Ray compatibility
30
+
31
+
**Important**: AWS X-Ray SDK/Daemon enters maintenance mode on **February 25th, 2026**, with AWS limiting releases to security fixes only. AWS is transitioning to OpenTelemetry as the primary instrumentation standard for application tracing. We recommend using the OpenTelemetry sidecar option for X-Ray integration rather than the legacy X-Ray daemon.
32
+
33
+
See [examples/with-datadog-tracing](./examples/with-datadog-tracing), [examples/with-xray-tracing](./examples/with-xray-tracing), and [examples/with-otel-tracing](./examples/with-otel-tracing) for complete configuration examples.
34
+
35
+
### ⚠️ Breaking Changes
36
+
37
+
**Removed Variables**
38
+
-`database_url` and `database_read_only_url` (already discouraged in v1.x) - use `sensitive_env_vars` instead
39
+
-`license_token_wo` and `license_token_wo_version` - consolidated into single `license_token` variable
40
+
41
+
**Migration:**
42
+
43
+
**Database URLs** (if you were still using these variables):
The module is also available [on the OpenTofu registry](https://search.opentofu.org/module/spacelift-io/ecs-spacelift-selfhosted/aws/latest) where you can browse the input and output variables.
@@ -12,7 +79,8 @@ The module is also available [on the OpenTofu registry](https://search.opentofu.
12
79
13
80
Check out the [Terraform](https://developer.hashicorp.com/terraform/language/backend) or the [OpenTofu](https://opentofu.org/docs/language/settings/backends/configuration/) backend documentation for more information on how to configure the state storage.
14
81
15
-
> ⚠️ Do **not** import the state into Spacelift after the installation: that would cause circular dependencies, and in case you accidentally break the Spacelift installation, you wouldn't be able to fix it.
82
+
> [!WARNING]
83
+
> Do **not** import the state into Spacelift after the installation: that would cause circular dependencies, and in case you accidentally break the Spacelift installation, you wouldn't be able to fix it.
license_token_wo = "<your-license-token-issued-by-Spacelift>" # 'wo' stands for 'write-only', it means that the token will not be stored in the state file
46
-
license_token_wo_version = "1" # Bump this when rotating the token
datadog_api_key = var.datadog_api_key # Your Datadog API key, stored in SecretsManager (versions automatically managed)
18
+
datadog_agent_config = {
19
+
image = "public.ecr.aws/datadog/agent:7"
20
+
site = "datadoghq.com" # or "datadoghq.eu" for EU
21
+
tags = [
22
+
"env:production",
23
+
"service:spacelift",
24
+
"team:platform"
25
+
]
26
+
log_configuration = {
27
+
logDriver = "awslogs"
28
+
options = {
29
+
"awslogs-group" = "/aws/ecs/datadog-agent"
30
+
"awslogs-region" = var.region
31
+
"awslogs-create-group" = "true"
32
+
"awslogs-stream-prefix" = "datadog"
33
+
}
34
+
}
35
+
}
36
+
}
37
+
```
38
+
39
+
> [!IMPORTANT]
40
+
> **Rotating Datadog API Key**
41
+
>
42
+
> The Datadog API key is stored in AWS Secrets Manager. To rotate it, simply update the value and apply:
43
+
>
44
+
> ```hcl
45
+
> datadog_api_key = var.new_datadog_api_key
46
+
> ```
47
+
48
+
> [!TIP]
49
+
> **Start with Logs Enabled**
50
+
>
51
+
> It's always recommended to start with CloudWatch logging enabled for the Datadog agent sidecar when first setting up tracing. This allows you to verify the agent is working correctly and troubleshoot any issues. Once you've confirmed everything is working as expected, you can remove the `log_configuration` to save on CloudWatch Logs costs.
0 commit comments