generated from gfkse/template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
datadog_default_task_def.tf
114 lines (109 loc) · 3.49 KB
/
datadog_default_task_def.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
data "aws_region" "current" {}
data "aws_caller_identity" "current" {}
data "template_file" "dd_dogstatsd_mapper_profiles" {
template = var.datadog_task_definition_file_dd_statsd_mapper_profiles == null ? file(local.dd_statsd_mapper_profiles_file) : file(var.datadog_task_definition_file_dd_statsd_mapper_profiles)
}
locals {
dd_api_key_param_arn_prefix = "arn:aws:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter/"
dd_api_key_param_arn = join("", [local.dd_api_key_param_arn_prefix, trimprefix(var.dd_api_key_parameter_name, "/")])
dd_api_enc_kms_key_arn_prefix = "arn:aws:kms:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:key/"
dd_api_enc_kms_key_arn = (var.dd_api_encryption_kms_key_id != null && var.dd_api_encryption_kms_key_id != "") ? join("", [local.dd_api_enc_kms_key_arn_prefix, var.dd_api_encryption_kms_key_id, "/"]) : ""
container_definition = [
{
name = "datadog-agent",
image = var.datadog_agent_image,
essential = true,
cpu = var.datadog_container_cpu,
memory = var.datadog_container_memory,
portMappings = [
{
hostPort = 8125,
protocol = "udp",
containerPort = 8125
},
{
hostPort = 8126,
protocol = "tcp",
containerPort = 8126
},
{
hostPort = 5555,
protocol = "tcp",
containerPort = 5555
}
],
secrets = [
{
name = "DD_API_KEY",
valueFrom = local.dd_api_key_param_arn
}
],
environment = [
{
name : "DD_LOGS_ENABLED",
value : "true"
},
{
name = "DD_SITE",
value = "datadoghq.eu"
},
{
name = "DD_DOGSTATSD_NON_LOCAL_TRAFFIC",
value = "true"
},
{
name = "DD_DOGSTATSD_PORT",
value = "8125"
},
{
name = "DD_DOGSTATSD_DISABLE",
value = "false"
},
{
name = "DD_DOGSTATSD_METRICS_STATS_ENABLE",
value = "false"
},
{
name = "DD_DOGSTATSD_MAPPER_PROFILES",
value = replace(replace(data.template_file.dd_dogstatsd_mapper_profiles.rendered, "\n", ""), " ", "")
},
{
name = "DD_HEALTH_PORT",
value = "5555"
}
],
mountPoints = [
{
containerPath = "/var/run/docker.sock",
sourceVolume = "docker_sock",
readOnly = true
},
{
containerPath = "/host/sys/fs/cgroup",
sourceVolume = "cgroup",
readOnly = true
},
{
containerPath = "/host/proc",
sourceVolume = "proc",
readOnly = true
}
],
dockerLabels = {
"com.datadoghq.ad.instances" = "[{\"url\": \"${var.service_endpoint_url}\"}]",
"com.datadoghq.ad.check_names" = "[\"airflow\"]",
"com.datadoghq.ad.init_configs" = "[{}]"
},
logConfiguration = {
"logDriver" = "awslogs",
"options" = {
"awslogs-create-group" = tostring(var.datadog_log_group_creation),
"awslogs-group" = "/ecs/${var.datadog_log_group_name}",
"awslogs-region" = var.region,
"awslogs-stream-prefix" = "ecs"
},
"secretOptions" = []
}
}
]
}