Skip to content

Commit c0cbfbd

Browse files
committed
fix: Covert OTEL configuration to a more agnostic approach.
1 parent 3fba08a commit c0cbfbd

3 files changed

Lines changed: 21 additions & 9 deletions

File tree

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ module "ecs_service" {
162162
region = data.aws_region.current.name
163163
namespace = "${var.project}/${var.service}"
164164
env_vars = var.environment_variables
165+
otel_entrypoint = var.otel_entrypoint
165166
otel_image = var.otel_image
166167
otel_log_level = var.otel_log_level
167168
otel_secrets = var.otel_secrets

templates/container_definitions.yaml.tftpl

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
%{~ endif ~}
3333
environment:
3434
%{~ for key, value in env_vars ~}
35-
- name: ${key}
35+
- name: "${key}"
3636
value: "${value}"
3737
%{~ endfor ~}
3838
secrets:
3939
%{~ for key, value in env_secrets ~}
40-
- name: ${key}
40+
- name: "${key}"
4141
valueFrom: "${value}"
4242
%{~ endfor ~}
4343
%{~ if enable_appconfig_agent ~}
@@ -54,14 +54,12 @@
5454
- containerPort: ${appconfig_agent_port}
5555
environment:
5656
%{~ for key, value in appconfig_agent_env_vars ~}
57-
- name: ${key}
57+
- name: "${key}"
5858
value: "${value}"
5959
%{~ endfor ~}
6060
%{~ endif ~}
6161
- name: otel-collector
6262
image: ${otel_image}:${otel_version}
63-
memory: 512
64-
cpu: 256
6563
essential: false
6664
logConfiguration:
6765
logDriver: awslogs
@@ -70,13 +68,18 @@
7068
awslogs-region: "${region}"
7169
awslogs-stream-prefix: "otel-collector"
7270
environment:
71+
- name: DD_OTELCOLLECTOR_ENABLED
72+
value: "true"
7373
- name: OTEL_LOG_LEVEL
74-
value: ${otel_log_level}
74+
value: "${otel_log_level}"
7575
secrets:
76-
- name: AOT_CONFIG_CONTENT
76+
- name: OTEL_CONFIG
7777
valueFrom: "${otel_ssm_arn}"
7878
%{~ for key, value in otel_secrets ~}
79-
- name: ${key}
79+
- name: "${key}"
8080
valueFrom: "${value}"
8181
%{~ endfor ~}
82-
command: ["--config=/etc/ecs/container-insights/otel-task-metrics-config.yaml"]
82+
%{~ if otel_entrypoint != null ~}
83+
entryPoint: ${jsonencode(otel_entrypoint)}
84+
%{~ endif ~}
85+
command: ["--config=env:OTEL_CONFIG"]

variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,14 @@ variable "otel_config" {
324324
default = null
325325
}
326326

327+
variable "otel_entrypoint" {
328+
type = list(string)
329+
description = <<-EOT
330+
Entrypoint for the OpenTelemetry collector sidecar.
331+
EOT
332+
default = null
333+
}
334+
327335
variable "otel_image" {
328336
type = string
329337
description = <<-EOT

0 commit comments

Comments
 (0)