-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatadog_synthetics_test.tf
executable file
·50 lines (49 loc) · 1.5 KB
/
datadog_synthetics_test.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
resource "datadog_synthetics_test" "default" {
for_each = {
for s in var.settings : s.request_definition.url => s
if s.type == "default"
}
assertion {
operator = "lessThan"
target = each.value.response.time
type = "responseTime"
}
assertion {
operator = "is"
target = each.value.response.code
type = "statusCode"
}
locations = ["aws:ap-northeast-1"]
message = "${local.message} ${var.notify_slack_channel} ${var.pagerduty_service}"
name = "API test on ${each.value.request_definition.url}"
options_list {
tick_every = each.value.options_list.tick_every
retry {
count = each.value.options_list.retry.count
interval = each.value.options_list.retry.interval
}
monitor_options {
renotify_interval = each.value.options_list.monitor_options.renotify_interval
}
scheduling {
dynamic "timeframes" {
for_each = each.value.options_list.scheduling.days
content {
day = timeframes.value
from = each.value.options_list.scheduling.from
to = each.value.options_list.scheduling.to
}
}
timezone = each.value.options_list.scheduling.timezone
}
}
request_definition {
url = each.value.request_definition.url
method = each.value.request_definition.method
body = each.value.request_definition.body
}
request_headers = each.value.request_headers
status = each.value.status
tags = var.tags
type = "api"
}