Skip to content

Commit 7b05bf3

Browse files
Remove missing_series_evals_to_resolve
1 parent af63b06 commit 7b05bf3

File tree

2 files changed

+16
-45
lines changed

2 files changed

+16
-45
lines changed

docs/resources/rule_group.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ Optional:
144144
- `is_paused` (Boolean) Sets whether the alert should be paused or not. Defaults to `false`.
145145
- `keep_firing_for` (String) The amount of time for which the rule will considered to be Recovering after initially Firing. Before this time has elapsed, the rule will continue to fire once it's been triggered.
146146
- `labels` (Map of String) Key-value pairs to attach to the alert rule that can be used in matching, grouping, and routing. Defaults to `map[]`.
147-
- `missing_series_evals_to_resolve` (Number) The number of missing series evaluations that must occur before the rule is considered to be resolved.
148147
- `no_data_state` (String) Describes what state to enter when the rule's query returns No Data. Options are OK, NoData, KeepLast, and Alerting. Defaults to NoData if not set.
149148
- `notification_settings` (Block List, Max: 1) Notification settings for the rule. If specified, it overrides the notification policies. Available since Grafana 10.4, requires feature flag 'alertingSimplifiedRouting' to be enabled. (see [below for nested schema](#nestedblock--rule--notification_settings))
150149
- `record` (Block List, Max: 1) Settings for a recording rule. Available since Grafana 11.2, requires feature flag 'grafanaManagedRecordingRules' to be enabled. (see [below for nested schema](#nestedblock--rule--record))

internal/resources/grafana/resource_alerting_rule_group.go

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
goapi "github.com/grafana/grafana-openapi-client-go/client"
1616
"github.com/grafana/grafana-openapi-client-go/client/provisioning"
1717
"github.com/grafana/grafana-openapi-client-go/models"
18-
"github.com/hashicorp/go-cty/cty"
1918
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
2019
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
2120
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -116,17 +115,6 @@ This resource requires Grafana 9.1.0 or later.
116115
return oldDuration == newDuration
117116
},
118117
},
119-
"missing_series_evals_to_resolve": {
120-
Type: schema.TypeInt,
121-
Optional: true,
122-
Description: "The number of missing series evaluations that must occur before the rule is considered to be resolved.",
123-
ValidateDiagFunc: func(i any, path cty.Path) (diags diag.Diagnostics) {
124-
if i != nil && i.(int) < 1 {
125-
return diag.Errorf("missing_series_evals_to_resolve must be greater than or equal to 1")
126-
}
127-
return nil
128-
},
129-
},
130118
"no_data_state": {
131119
Type: schema.TypeString,
132120
Optional: true,
@@ -546,10 +534,6 @@ func packAlertRule(r *models.ProvisionedAlertRule) (interface{}, error) {
546534
json["keep_firing_for"] = r.KeepFiringFor.String()
547535
}
548536

549-
if r.MissingSeriesEvalsToResolve >= 1 {
550-
json["missing_series_evals_to_resolve"] = r.MissingSeriesEvalsToResolve
551-
}
552-
553537
return json, nil
554538
}
555539

@@ -583,14 +567,6 @@ func unpackAlertRule(raw interface{}, groupName string, folderUID string, orgID
583567
return nil, err
584568
}
585569

586-
var missingSeriesEvalsToResolve int64
587-
if val, ok := json["missing_series_evals_to_resolve"]; ok && val != nil {
588-
intVal := val.(int)
589-
if intVal >= 1 {
590-
missingSeriesEvalsToResolve = int64(intVal)
591-
}
592-
}
593-
594570
// Check for conflicting fields before unpacking the rest of the rule.
595571
// This is a workaround due to the lack of support for ConflictsWith in Lists in the SDK.
596572
errState := json["exec_err_state"].(string)
@@ -606,9 +582,6 @@ func unpackAlertRule(raw interface{}, groupName string, folderUID string, orgID
606582
if keepFiringForDuration != 0 {
607583
return nil, fmt.Errorf(incompatFieldMsgFmt, "keep_firing_for")
608584
}
609-
if missingSeriesEvalsToResolve != 0 {
610-
return nil, fmt.Errorf(incompatFieldMsgFmt, "missing_series_evals_to_resolve")
611-
}
612585
if noDataState != "" {
613586
return nil, fmt.Errorf(incompatFieldMsgFmt, "no_data_state")
614587
}
@@ -634,23 +607,22 @@ func unpackAlertRule(raw interface{}, groupName string, folderUID string, orgID
634607
}
635608

636609
rule := models.ProvisionedAlertRule{
637-
UID: json["uid"].(string),
638-
Title: common.Ref(json["name"].(string)),
639-
FolderUID: common.Ref(folderUID),
640-
RuleGroup: common.Ref(groupName),
641-
OrgID: common.Ref(orgID),
642-
ExecErrState: common.Ref(errState),
643-
NoDataState: common.Ref(noDataState),
644-
For: common.Ref(strfmt.Duration(forDuration)),
645-
KeepFiringFor: strfmt.Duration(keepFiringForDuration),
646-
Data: data,
647-
Condition: common.Ref(condition),
648-
Labels: unpackMap(json["labels"]),
649-
Annotations: unpackMap(json["annotations"]),
650-
IsPaused: json["is_paused"].(bool),
651-
NotificationSettings: ns,
652-
Record: unpackRecord(json["record"]),
653-
MissingSeriesEvalsToResolve: missingSeriesEvalsToResolve,
610+
UID: json["uid"].(string),
611+
Title: common.Ref(json["name"].(string)),
612+
FolderUID: common.Ref(folderUID),
613+
RuleGroup: common.Ref(groupName),
614+
OrgID: common.Ref(orgID),
615+
ExecErrState: common.Ref(errState),
616+
NoDataState: common.Ref(noDataState),
617+
For: common.Ref(strfmt.Duration(forDuration)),
618+
KeepFiringFor: strfmt.Duration(keepFiringForDuration),
619+
Data: data,
620+
Condition: common.Ref(condition),
621+
Labels: unpackMap(json["labels"]),
622+
Annotations: unpackMap(json["annotations"]),
623+
IsPaused: json["is_paused"].(bool),
624+
NotificationSettings: ns,
625+
Record: unpackRecord(json["record"]),
654626
}
655627

656628
return &rule, nil

0 commit comments

Comments
 (0)