-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.tf
87 lines (81 loc) · 2.18 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
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
data "pagerduty_vendor" "datadog" {
name = "Datadog"
}
data "pagerduty_priority" "p1" {
name = "P1"
}
data "pagerduty_priority" "p2" {
name = "P2"
}
data "pagerduty_priority" "p3" {
name = "P3"
}
data "pagerduty_priority" "p4" {
name = "P4"
}
data "pagerduty_priority" "p5" {
name = "P5"
}
resource "pagerduty_event_orchestration_service" "datadog" {
service = var.service_id
enable_event_orchestration_for_service = var.enabled
set {
id = "start"
rule {
condition {
expression = "event.source matches '${data.pagerduty_vendor.datadog.name}' and event.severity matches 'warning' and event.custom_details.alert_priority matches '^P(1|2)$'"
}
actions {
severity = "warning"
}
}
rule {
condition {
expression = "event.custom_details.priority matches 'normal' and event.severity matches 'error' and event.custom_details.alert_priority matches 'P1'"
}
actions {
priority = data.pagerduty_priority.p1.id
severity = "critical"
}
}
rule {
condition {
expression = "event.custom_details.priority matches 'normal' and event.severity matches 'error' and event.custom_details.alert_priority matches 'P2'"
}
actions {
priority = data.pagerduty_priority.p2.id
severity = "error"
}
}
rule {
condition {
expression = "event.custom_details.priority matches 'normal' and event.custom_details.alert_priority matches 'P3'"
}
actions {
priority = data.pagerduty_priority.p3.id
severity = "warning"
}
}
rule {
condition {
expression = "event.custom_details.priority matches 'normal' and event.custom_details.alert_priority matches 'P4'"
}
actions {
priority = data.pagerduty_priority.p4.id
severity = "warning"
}
}
rule {
condition {
expression = "event.custom_details.priority matches 'normal' and event.custom_details.alert_priority matches 'P5'"
}
actions {
priority = data.pagerduty_priority.p5.id
severity = "info"
}
}
}
catch_all {
actions {}
}
}