-
Notifications
You must be signed in to change notification settings - Fork 8
/
ecs_datadog.tf
61 lines (55 loc) · 1.35 KB
/
ecs_datadog.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
resource "aws_ecs_task_definition" "datadog" {
family = "${var.env}-${var.identifier}-datadog-task"
task_role_arn = "${aws_iam_role.ecs-datadog-role.arn}"
container_definitions = <<EOF
[
{
"name": "${var.env}-${var.identifier}",
"image": "datadog/agent:latest",
"cpu": 10,
"memory": 256,
"environment": [{
"name" : "DD_API_KEY",
"value" : "${var.datadog-api-key}"
}],
"command": [
"bash",
"-c",
"${var.datadog-extra-config}"
],
"mountPoints": [{
"sourceVolume": "docker-sock",
"containerPath": "/var/run/docker.sock",
"readOnly": true
},{
"sourceVolume": "proc",
"containerPath": "/host/proc",
"readOnly": true
},{
"sourceVolume": "cgroup",
"containerPath": "/host/sys/fs/cgroup",
"readOnly": true
}]
}
]
EOF
volume {
name = "docker-sock"
host_path = "/var/run/docker.sock"
}
volume {
name = "proc"
host_path = "/proc/"
}
volume {
name = "cgroup"
host_path = "/cgroup/"
}
}
resource "aws_ecs_service" "datadog" {
name = "${var.env}-${var.identifier}-datadog-ecs-service"
cluster = "${var.ecs-cluster-id}"
task_definition = "${aws_ecs_task_definition.datadog.arn}"
# This allows running once for every instance
scheduling_strategy = "DAEMON"
}