Alerting: Use expected field name for receiver in HCL export (#87065)

* Use expected field name for receiver in hcl

Terraform provider expects `contact_point` instead of `receiver` in
notification settings on a rule.
This commit is contained in:
William Wernert 2024-04-29 13:13:29 -04:00 committed by GitHub
parent 3845033308
commit 70ff229bed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View File

@ -694,7 +694,7 @@ func TestProvisioningApi(t *testing.T) {
is_paused = false
notification_settings {
receiver = "Test-Receiver"
contact_point = "Test-Receiver"
group_by = ["alertname", "grafana_folder", "test"]
group_wait = "1s"
group_interval = "5s"

View File

@ -79,7 +79,7 @@ resource "grafana_rule_group" "rule_group_0000" {
is_paused = false
notification_settings {
receiver = "Test-Receiver"
contact_point = "Test-Receiver"
group_by = ["alertname", "grafana_folder", "test"]
group_wait = "1s"
group_interval = "5s"

View File

@ -292,7 +292,8 @@ type RelativeTimeRangeExport struct {
// AlertRuleNotificationSettingsExport is the provisioned export of models.NotificationSettings.
type AlertRuleNotificationSettingsExport struct {
Receiver string `yaml:"receiver,omitempty" json:"receiver,omitempty" hcl:"receiver"`
// Terraform provider uses `contact_point`, so export the field with that name in HCL.
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"`