-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteam_routing_rules.tf
37 lines (29 loc) · 1.07 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
resource "opsgenie_team_routing_rule" "this" {
for_each = module.this.enabled ? { 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
}
}
}