Skip to content

Commit 6bfb0ed

Browse files
committed
Datadog Socket:
- Rename volume name - Parameterize
1 parent 5d6c711 commit 6bfb0ed

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

main.tf

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ locals {
3333

3434
secrets = module.ssm.secrets
3535

36-
mountPoints = var.ecs_launch_type == "FARGATE" ? [] : [
36+
mountPoints = var.ecs_launch_type == "FARGATE" ? [] : concat([
3737
{
3838
containerPath = "/var/run/docker.sock"
39-
sourceVolume = "docker_sock"
39+
sourceVolume = "docker-sock"
4040
},
4141
{
4242
containerPath = "/host/sys/fs/cgroup"
@@ -51,13 +51,15 @@ locals {
5151
// readOnly = true
5252
},
5353

54-
var.socket_apm_enabled_on_ec2 ? {
54+
55+
],
56+
var.socket_apm_enabled_on_ec2 ? [{
5557
containerPath = "/var/run/datadog.sock"
56-
sourceVolume = "datadog_sock"
58+
sourceVolume = "datadog-sock"
5759
// This is disabled temporarily to overcome json unmarshaling issue
5860
// readOnly = true
59-
} : {}
60-
]
61+
}] : []
62+
)
6163

6264

6365
portMappings = var.ecs_launch_type == "FARGATE" ? [] : [
@@ -80,9 +82,9 @@ locals {
8082
}
8183
}
8284

83-
volumes = var.ecs_launch_type == "FARGATE" ? [] : [
85+
volumes = var.ecs_launch_type == "FARGATE" ? [] : concat([
8486
{
85-
name = "docker_sock"
87+
name = "docker-sock"
8688
host_path = "/var/run/docker.sock"
8789
},
8890
{
@@ -92,17 +94,19 @@ locals {
9294
{
9395
name = "cgroup"
9496
host_path = "/cgroup/"
95-
},
96-
{
97-
name = "datadog_sock"
97+
}
98+
99+
],
100+
var.socket_apm_enabled_on_ec2 ? [{
101+
name = "datadog-sock"
98102
host_path = "/var/run/datadog.sock"
99103
mount_point = {
100-
"sourceVolume" = "datadog_sock"
104+
"sourceVolume" = "datadog-sock"
101105
"containerPath" = "/var/run/datadog.sock"
102106
"readOnly" = null
103107
}
104-
}
105-
]
108+
}] : []
109+
)
106110

107111
}
108112

0 commit comments

Comments
 (0)