Alerting: Also fix HCL field name for MuteTimeIntervals (#87079)

* Correct HCL field name for MuteTimeIntervals

* Update test
This commit is contained in:
William Wernert 2024-04-30 11:14:01 -04:00 committed by GitHub
parent 5e060d2d99
commit 93519f70ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 18 deletions

View File

@ -694,12 +694,12 @@ func TestProvisioningApi(t *testing.T) {
is_paused = false
notification_settings {
contact_point = "Test-Receiver"
group_by = ["alertname", "grafana_folder", "test"]
group_wait = "1s"
group_interval = "5s"
repeat_interval = "5m"
mute_time_intervals = ["test-mute"]
contact_point = "Test-Receiver"
group_by = ["alertname", "grafana_folder", "test"]
group_wait = "1s"
group_interval = "5s"
repeat_interval = "5m"
mute_timings = ["test-mute"]
}
}
}

View File

@ -79,12 +79,12 @@ resource "grafana_rule_group" "rule_group_0000" {
is_paused = false
notification_settings {
contact_point = "Test-Receiver"
group_by = ["alertname", "grafana_folder", "test"]
group_wait = "1s"
group_interval = "5s"
repeat_interval = "5m"
mute_time_intervals = ["test-mute"]
contact_point = "Test-Receiver"
group_by = ["alertname", "grafana_folder", "test"]
group_wait = "1s"
group_interval = "5s"
repeat_interval = "5m"
mute_timings = ["test-mute"]
}
}
}

View File

@ -291,13 +291,15 @@ type RelativeTimeRangeExport struct {
}
// AlertRuleNotificationSettingsExport is the provisioned export of models.NotificationSettings.
// Field name mismatches with Terraform provider schema are noted where applicable.
type AlertRuleNotificationSettingsExport struct {
// Terraform provider uses `contact_point`, so export the field with that name in HCL.
// TF -> `contact_point`
Receiver string `yaml:"receiver,omitempty" json:"receiver,omitempty" hcl:"contact_point"`
GroupBy []string `yaml:"group_by,omitempty" json:"group_by,omitempty" hcl:"group_by"`
GroupWait *string `yaml:"group_wait,omitempty" json:"group_wait,omitempty" hcl:"group_wait,optional"`
GroupInterval *string `yaml:"group_interval,omitempty" json:"group_interval,omitempty" hcl:"group_interval,optional"`
RepeatInterval *string `yaml:"repeat_interval,omitempty" json:"repeat_interval,omitempty" hcl:"repeat_interval,optional"`
MuteTimeIntervals []string `yaml:"mute_time_intervals,omitempty" json:"mute_time_intervals,omitempty" hcl:"mute_time_intervals"`
GroupBy []string `yaml:"group_by,omitempty" json:"group_by,omitempty" hcl:"group_by"`
GroupWait *string `yaml:"group_wait,omitempty" json:"group_wait,omitempty" hcl:"group_wait,optional"`
GroupInterval *string `yaml:"group_interval,omitempty" json:"group_interval,omitempty" hcl:"group_interval,optional"`
RepeatInterval *string `yaml:"repeat_interval,omitempty" json:"repeat_interval,omitempty" hcl:"repeat_interval,optional"`
// TF -> `mute_timings`
MuteTimeIntervals []string `yaml:"mute_time_intervals,omitempty" json:"mute_time_intervals,omitempty" hcl:"mute_timings"`
}