-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathescalation_cloud.tf
117 lines (109 loc) · 3.23 KB
/
escalation_cloud.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
115
116
117
resource "pagerduty_schedule" "cloud_primary" {
name = "Cloud Team - Primary On Call"
time_zone = "Europe/London"
teams = [pagerduty_team.teams["cloud"].id]
layer {
name = "Weekdays"
rotation_turn_length_seconds = 24 * 60 * 60
rotation_virtual_start = "2021-11-01T12:00:00+00:00"
start = "2021-11-01T12:00:00+00:00"
users = [
pagerduty_user.users["wile.e.coyote"].id,
pagerduty_user.users["daffy.duck"].id,
pagerduty_user.users["cloud2"].id,
]
restriction {
duration_seconds = 4 * 24 * 60 * 60
start_day_of_week = 1
start_time_of_day = "12:00:00"
type = "weekly_restriction"
}
}
layer {
name = "Weekend"
rotation_turn_length_seconds = 7 * 24 * 60 * 60
rotation_virtual_start = "2021-11-01T12:00:00+00:00"
start = "2021-11-01T12:00:00+00:00"
users = [
pagerduty_user.users["daffy.duck"].id,
pagerduty_user.users["cloud2"].id,
pagerduty_user.users["wile.e.coyote"].id,
]
restriction {
duration_seconds = 3 * 24 * 60 * 60
start_day_of_week = 5
start_time_of_day = "12:00:00"
type = "weekly_restriction"
}
}
lifecycle {
ignore_changes = [
teams,
]
}
}
resource "pagerduty_schedule" "cloud_secondary" {
name = "Cloud Team - Secondary On Call"
time_zone = "Europe/London"
teams = [pagerduty_team.teams["cloud"].id]
layer {
name = "Weekdays"
rotation_turn_length_seconds = 24 * 60 * 60
rotation_virtual_start = "2021-11-01T12:00:00+00:00"
start = "2021-11-01T12:00:00+00:00"
users = [
pagerduty_user.users["daffy.duck"].id,
pagerduty_user.users["cloud2"].id,
pagerduty_user.users["wile.e.coyote"].id,
]
restriction {
duration_seconds = 4 * 24 * 60 * 60
start_day_of_week = 1
start_time_of_day = "12:00:00"
type = "weekly_restriction"
}
}
layer {
name = "Weekend"
rotation_turn_length_seconds = 7 * 24 * 60 * 60
rotation_virtual_start = "2021-11-01T12:00:00+00:00"
start = "2021-11-01T12:00:00+00:00"
users = [
pagerduty_user.users["cloud2"].id,
pagerduty_user.users["wile.e.coyote"].id,
pagerduty_user.users["daffy.duck"].id,
]
restriction {
duration_seconds = 3 * 24 * 60 * 60
start_day_of_week = 5
start_time_of_day = "12:00:00"
type = "weekly_restriction"
}
}
}
resource "pagerduty_escalation_policy" "cloud" {
name = "Cloud Team Escalation Policy"
num_loops = 2
teams = [pagerduty_team.teams["cloud"].id]
rule {
escalation_delay_in_minutes = 30
target {
id = pagerduty_schedule.cloud_primary.id
type = "schedule_reference"
}
}
rule {
escalation_delay_in_minutes = 30
target {
id = pagerduty_schedule.cloud_secondary.id
type = "schedule_reference"
}
}
rule {
escalation_delay_in_minutes = 30
target {
id = pagerduty_user.users["cloud1"].id
type = "user_reference"
}
}
}