-
Notifications
You must be signed in to change notification settings - Fork 0
/
team_routing_rules.tf
39 lines (31 loc) · 1.05 KB
/
team_routing_rules.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
resource "opsgenie_team_routing_rule" "this" {
for_each = {
for rule in local.team_routing_rules : rule.name => rule
}
name = each.value.name
# Look up Team ID by name
team_id = opsgenie_team.this[each.value.owner_team_name].id
order = try(each.value.order, 0)
timezone = try(each.value.timezone, "America/Los_Angeles")
criteria {
type = try(each.value.criteria.type, "match-all")
dynamic conditions {
for_each = try(each.value.criteria.conditions, [])
content {
expected_value = try(conditions.value.expected_value, null)
field = try(conditions.value.field, null)
key = try(conditions.value.key, null)
not = try(conditions.value.not, null)
operation = try(conditions.value.operation, null)
order = try(conditions.value.order, null)
}
}
}
dynamic notify {
for_each = try(each.value.notify, [])
content {
type = notify.value.type
id = opsgenie_escalation.this[notify.value.name].id
}
}
}