You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/data-sources/observability_alertgroup.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,3 +45,4 @@ Read-Only:
45
45
-`expression` (String) The PromQL expression to evaluate. Every evaluation cycle this is evaluated at the current time, and all resultant time series become pending/firing alerts.
46
46
-`for` (String) Alerts are considered firing once they have been returned for this long. Alerts which have not yet fired for long enough are considered pending. Default is 0s
47
47
-`labels` (Map of String) A map of key:value. Labels to add or overwrite for each alert
48
+
-`record` (String) The name of the metric. It's the identifier and must be unique in the group.
-`alert` (String) The name of the alert rule. Is the identifier and must be unique in the group.
80
74
-`expression` (String) The PromQL expression to evaluate. Every evaluation cycle this is evaluated at the current time, and all resultant time series become pending/firing alerts.
81
75
82
76
Optional:
83
77
78
+
-`alert` (String) The name of the alert rule. Is the identifier and must be unique in the group.
84
79
-`annotations` (Map of String) A map of key:value. Annotations to add or overwrite for each alert
85
80
-`for` (String) Alerts are considered firing once they have been returned for this long. Alerts which have not yet fired for long enough are considered pending. Default is 0s
86
81
-`labels` (Map of String) A map of key:value. Labels to add or overwrite for each alert
82
+
-`record` (String) The name of the metric. It's the identifier and must be unique in the group.
// Descriptions for the resource and data source schemas are centralized here.
@@ -75,6 +77,7 @@ var descriptions = map[string]string{
75
77
"for": "Alerts are considered firing once they have been returned for this long. Alerts which have not yet fired for long enough are considered pending. Default is 0s",
76
78
"labels": "A map of key:value. Labels to add or overwrite for each alert",
77
79
"annotations": "A map of key:value. Annotations to add or overwrite for each alert",
80
+
"record": "The name of the metric. It's the identifier and must be unique in the group.",
78
81
}
79
82
80
83
// NewAlertGroupResource is a helper function to simplify the provider implementation.
core.LogAndAddError(ctx, &resp.Diagnostics, "Error configuring alertgroup", "Both `alert` and `record` were set for a`rule`. Only one is allowed.")
138
+
}
139
+
140
+
// if record is set, `annotations` and `for` are not allowed
141
+
if (!rs[i].Record.IsNull() &&!rs[i].Record.IsUnknown()) && ((!rs[i].Annotations.IsNull() &&!rs[i].Annotations.IsUnknown()) || (!rs[i].For.IsNull() &&!rs[i].For.IsUnknown())) {
142
+
core.LogAndAddError(ctx, &resp.Diagnostics, "Error configuring alertgroup", "Setting either `annotations` or `for` when using `record` is not allowed.")
0 commit comments