Skip to content

Commit 5d6c711

Browse files
committed
Add datadog socket path
1 parent 47bdc62 commit 5d6c711

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

main.tf

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ locals {
1616

1717
// https://www.datadoghq.com/blog/monitor-aws-fargate/
1818
ECS_FARGATE = var.ecs_launch_type == "FARGATE" ? "true" : "false"
19-
}
19+
},
20+
(var.ecs_launch_type == "EC2" && var.socket_apm_enabled_on_ec2) ? {
21+
DD_APM_RECEIVER_SOCKET = "/var/run/datadog.sock"
22+
} : {}
2023
)
2124

2225
container_definition = {
@@ -46,7 +49,14 @@ locals {
4649
sourceVolume = "proc"
4750
// This is disabled temporarily to overcome json unmarshaling issue
4851
// readOnly = true
49-
}
52+
},
53+
54+
var.socket_apm_enabled_on_ec2 ? {
55+
containerPath = "/var/run/datadog.sock"
56+
sourceVolume = "datadog_sock"
57+
// This is disabled temporarily to overcome json unmarshaling issue
58+
// readOnly = true
59+
} : {}
5060
]
5161

5262

@@ -82,6 +92,15 @@ locals {
8292
{
8393
name = "cgroup"
8494
host_path = "/cgroup/"
95+
},
96+
{
97+
name = "datadog_sock"
98+
host_path = "/var/run/datadog.sock"
99+
mount_point = {
100+
"sourceVolume" = "datadog_sock"
101+
"containerPath" = "/var/run/datadog.sock"
102+
"readOnly" = null
103+
}
85104
}
86105
]
87106

variables.tf

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ variable "app_name" {
1111

1212

1313
variable "environment" {
14-
type = map(string)
14+
type = map(string)
1515
default = {}
1616
}
1717

1818
variable "secret_names" {
19-
type = list(string)
19+
type = list(string)
2020
default = []
2121
}
2222

@@ -25,12 +25,12 @@ variable "secret_names" {
2525
//}
2626

2727
variable "docker_image_name" {
28-
type = string
28+
type = string
2929
default = "datadog/agent"
3030
}
3131

3232
variable "docker_image_tag" {
33-
type = string
33+
type = string
3434
default = "latest"
3535
}
3636

@@ -46,6 +46,10 @@ variable "resource_requirements" {
4646
default = []
4747
}
4848

49+
variable "socket_apm_enabled_on_ec2" {
50+
default = true
51+
}
52+
4953
variable "enabled" {
5054
default = true
5155
}

0 commit comments

Comments
 (0)