Skip to content

Commit fdd3fc4

Browse files
Change resource schema to preserve ordering of steps
1 parent 5fcdbe8 commit fdd3fc4

File tree

4 files changed

+679
-384
lines changed

4 files changed

+679
-384
lines changed

docs/resources/apps_alertenrichment_alertenrichment_v1beta1.md

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,16 @@ resource "grafana_apps_alertenrichment_alertenrichment_v1beta1" "example" {
5656
}
5757
]
5858
59-
assign_step {
60-
annotations = {
61-
enrichment_team = "alerting-team"
62-
runbook_url = "https://runbooks.grafana.com/critical-alerts"
63-
contact_slack = "#alerts-critical"
64-
incident_severity = "high"
59+
step {
60+
assign {
61+
annotations = {
62+
enrichment_team = "alerting-team"
63+
runbook_url = "https://runbooks.grafana.com/critical-alerts"
64+
contact_slack = "#alerts-critical"
65+
incident_severity = "high"
66+
}
67+
timeout = "30s"
6568
}
66-
timeout = "30s"
6769
}
6870
}
6971
}
@@ -119,10 +121,10 @@ Optional:
119121

120122
- `alert_rule_uids` (List of String) UIDs of alert rules this enrichment applies to. If empty, applies to all alert rules.
121123
- `annotation_matchers` (List of Object) Annotation matchers that an alert must satisfy for this enrichment to apply. Each matcher is an object with: 'type' (string, one of: =, !=, =~, !~), 'name' (string, annotation key to match), 'value' (string, annotation value to compare against, supports regex for =~/!~ operators). (see [below for nested schema](#nestedatt--spec--annotation_matchers))
122-
- `assign_step` (Block List) Assign enricher step that adds or modifies annotations on alerts. (see [below for nested schema](#nestedblock--spec--assign_step))
123124
- `description` (String) Description of the alert enrichment.
124125
- `label_matchers` (List of Object) Label matchers that an alert must satisfy for this enrichment to apply. Each matcher is an object with: 'type' (string, one of: =, !=, =~, !~), 'name' (string, label key to match), 'value' (string, label value to compare against, supports regex for =~/!~ operators). (see [below for nested schema](#nestedatt--spec--label_matchers))
125126
- `receivers` (List of String) Receiver names to match. If empty, applies to all receivers.
127+
- `step` (Block List) Enrichment step. Can be repeated multiple times to define a sequence of steps. Each step must contain exactly one enrichment block. (see [below for nested schema](#nestedblock--spec--step))
126128

127129
<a id="nestedatt--spec--annotation_matchers"></a>
128130
### Nested Schema for `spec.annotation_matchers`
@@ -134,23 +136,27 @@ Optional:
134136
- `value` (String)
135137

136138

137-
<a id="nestedblock--spec--assign_step"></a>
138-
### Nested Schema for `spec.assign_step`
139+
<a id="nestedatt--spec--label_matchers"></a>
140+
### Nested Schema for `spec.label_matchers`
139141

140-
Required:
142+
Optional:
141143

142-
- `annotations` (Map of String) Map of annotation names to values to set on matching alerts. Values can use Go template syntax with access to $labels and $annotations.
144+
- `name` (String)
145+
- `type` (String)
146+
- `value` (String)
143147

144-
Optional:
145148

146-
- `timeout` (String) Maximum execution time (e.g., '30s', '1m'). Defaults to 30s.
149+
<a id="nestedblock--spec--step"></a>
150+
### Nested Schema for `spec.step`
147151

152+
Optional:
148153

149-
<a id="nestedatt--spec--label_matchers"></a>
150-
### Nested Schema for `spec.label_matchers`
154+
- `assign` (Block, Optional) Assign annotations to an alert. (see [below for nested schema](#nestedblock--spec--step--assign))
155+
156+
<a id="nestedblock--spec--step--assign"></a>
157+
### Nested Schema for `spec.step.assign`
151158

152159
Optional:
153160

154-
- `name` (String)
155-
- `type` (String)
156-
- `value` (String)
161+
- `annotations` (Map of String) Map of annotation names to values to set on matching alerts.
162+
- `timeout` (String) Maximum execution time (e.g., '30s', '1m')

examples/resources/grafana_apps_alertenrichment_alertenrichment_v1beta1/resource.tf

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ resource "grafana_apps_alertenrichment_alertenrichment_v1beta1" "example" {
4141
}
4242
]
4343

44-
assign_step {
45-
annotations = {
46-
enrichment_team = "alerting-team"
47-
runbook_url = "https://runbooks.grafana.com/critical-alerts"
48-
contact_slack = "#alerts-critical"
49-
incident_severity = "high"
44+
step {
45+
assign {
46+
annotations = {
47+
enrichment_team = "alerting-team"
48+
runbook_url = "https://runbooks.grafana.com/critical-alerts"
49+
contact_slack = "#alerts-critical"
50+
incident_severity = "high"
51+
}
52+
timeout = "30s"
5053
}
51-
timeout = "30s"
5254
}
5355
}
5456
}

0 commit comments

Comments
 (0)