forked from kabisa/terraform-datadog-service-check-monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
47 lines (36 loc) · 1.17 KB
/
main.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
locals {
notification_channel = var.alerting_enabled ? var.notification_channel : ""
service_display_name = var.service_display_name != null ? var.service_display_name : var.service
}
resource "datadog_monitor" "monitor" {
count = var.enabled ? 1 : 0
name = join(" - ", compact([
var.name_prefix,
local.service_display_name,
var.name,
var.name_suffix
]))
type = "service check"
query = local.query
message = templatefile("${path.module}/alert.tpl", {
alert_message = var.alert_message
recovery_message = var.recovery_message
no_data_message = var.no_data_message
note = var.note
docs = var.docs
custom_message = var.custom_message
notification_channel = local.notification_channel
})
tags = local.normalized_tags
priority = var.priority
no_data_timeframe = var.no_data_timeframe
notify_no_data = var.notify_no_data
timeout_h = var.auto_resolve_time_h
require_full_window = var.require_full_window
monitor_thresholds {
critical = var.critical_threshold
warning = var.warning_threshold
ok = var.ok_threshold
}
restricted_roles = var.restricted_roles
}