Skip to content

Commit 759aff4

Browse files
authored
feat(grafana): increase notification policy depth to 5 (#2466)
This increases the supported notification policy tree depth from 4 to 5, allowing for more complex notification policies in Grafana alerting.
1 parent 480b2fe commit 759aff4

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

docs/resources/notification_policy.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,32 @@ Required:
209209
<a id="nestedblock--policy--policy--policy--policy"></a>
210210
### Nested Schema for `policy.policy.policy.policy`
211211

212+
Optional:
213+
214+
- `active_timings` (List of String) A list of time interval names to apply to alerts that match this policy to suppress them unless they are sent at the specified time. Supported in Grafana 12.1.0 and later
215+
- `contact_point` (String) The contact point to route notifications that match this rule to.
216+
- `continue` (Boolean) Whether to continue matching subsequent rules if an alert matches the current rule. Otherwise, the rule will be 'consumed' by the first policy to match it.
217+
- `group_by` (List of String) A list of alert labels to group alerts into notifications by. Use the special label `...` to group alerts by all labels, effectively disabling grouping. Required for root policy only. If empty, the parent grouping is used.
218+
- `group_interval` (String) Minimum time interval between two notifications for the same group. Default is 5 minutes.
219+
- `group_wait` (String) Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds.
220+
- `matcher` (Block Set) Describes which labels this rule should match. When multiple matchers are supplied, an alert must match ALL matchers to be accepted by this policy. When no matchers are supplied, the rule will match all alert instances. (see [below for nested schema](#nestedblock--policy--policy--policy--policy--matcher))
221+
- `mute_timings` (List of String) A list of time intervals to apply to alerts that match this policy to mute them for the specified time.
222+
- `policy` (Block List) Routing rules for specific label sets. (see [below for nested schema](#nestedblock--policy--policy--policy--policy--policy))
223+
- `repeat_interval` (String) Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours.
224+
225+
<a id="nestedblock--policy--policy--policy--policy--matcher"></a>
226+
### Nested Schema for `policy.policy.policy.policy.matcher`
227+
228+
Required:
229+
230+
- `label` (String) The name of the label to match against.
231+
- `match` (String) The operator to apply when matching values of the given label. Allowed operators are `=` for equality, `!=` for negated equality, `=~` for regex equality, and `!~` for negated regex equality.
232+
- `value` (String) The label value to match against.
233+
234+
235+
<a id="nestedblock--policy--policy--policy--policy--policy"></a>
236+
### Nested Schema for `policy.policy.policy.policy.policy`
237+
212238
Required:
213239

214240
- `group_by` (List of String) A list of alert labels to group alerts into notifications by. Use the special label `...` to group alerts by all labels, effectively disabling grouping. Required for root policy only. If empty, the parent grouping is used.
@@ -220,12 +246,12 @@ Optional:
220246
- `continue` (Boolean) Whether to continue matching subsequent rules if an alert matches the current rule. Otherwise, the rule will be 'consumed' by the first policy to match it.
221247
- `group_interval` (String) Minimum time interval between two notifications for the same group. Default is 5 minutes.
222248
- `group_wait` (String) Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds.
223-
- `matcher` (Block Set) Describes which labels this rule should match. When multiple matchers are supplied, an alert must match ALL matchers to be accepted by this policy. When no matchers are supplied, the rule will match all alert instances. (see [below for nested schema](#nestedblock--policy--policy--policy--policy--matcher))
249+
- `matcher` (Block Set) Describes which labels this rule should match. When multiple matchers are supplied, an alert must match ALL matchers to be accepted by this policy. When no matchers are supplied, the rule will match all alert instances. (see [below for nested schema](#nestedblock--policy--policy--policy--policy--policy--matcher))
224250
- `mute_timings` (List of String) A list of time intervals to apply to alerts that match this policy to mute them for the specified time.
225251
- `repeat_interval` (String) Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours.
226252

227-
<a id="nestedblock--policy--policy--policy--policy--matcher"></a>
228-
### Nested Schema for `policy.policy.policy.policy.matcher`
253+
<a id="nestedblock--policy--policy--policy--policy--policy--matcher"></a>
254+
### Nested Schema for `policy.policy.policy.policy.policy.matcher`
229255

230256
Required:
231257

internal/resources/grafana/resource_alerting_notification_policy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ This resource requires Grafana 9.1.0 or later.
9696

9797
// The maximum depth of policy tree that the provider supports, as Terraform does not allow for infinitely recursive schemas.
9898
// This can be increased without breaking backwards compatibility.
99-
const supportedPolicyTreeDepth = 4
99+
const supportedPolicyTreeDepth = 5
100100

101101
const PolicySingletonID = "policy"
102102

0 commit comments

Comments
 (0)