Skip to content

Commit

Permalink
fixing flow alert test (#177)
Browse files Browse the repository at this point in the history
* fixing flow alert test

* patch - changing notifications_group to computed
  • Loading branch information
OrNovo authored Nov 28, 2023
1 parent a63ee9d commit 820d22f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
13 changes: 8 additions & 5 deletions coralogix/resource_coralogix_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,13 @@ func AlertSchema() map[string]*schema.Schema {
Description: "The expiration date of the alert (if declared).",
},
"notifications_group": {
Type: schema.TypeSet,
Optional: true,
Elem: notificationGroupSchema(),
Set: schema.HashResource(notificationGroupSchema()),
Description: "Defines notifications settings over list of group-by keys (or on empty list).",
Type: schema.TypeSet,
Optional: true,
Computed: true,
Elem: notificationGroupSchema(),
Set: schema.HashResource(notificationGroupSchema()),
Description: "Defines notifications settings over list of group-by keys (or on empty list).",
AtLeastOneOf: []string{"notifications_group", "show_in_insights"},
},
"payload_filters": {
Type: schema.TypeSet,
Expand Down Expand Up @@ -306,6 +308,7 @@ func AlertSchema() map[string]*schema.Schema {
},
},
},
AtLeastOneOf: []string{"notifications_group", "show_in_insights"},
},
"scheduling": {
Type: schema.TypeList,
Expand Down
4 changes: 4 additions & 0 deletions coralogix/resource_coralogix_alert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,10 @@ func testAccCoralogixResourceAlertFLow(a *flowAlertTestParams) string {
group_by = ["coralogix.metadata.sdkId"]
}
}
show_in_insights {
retriggering_period_minutes = 60
notify_on = "Triggered_and_resolved"
}
}
resource "coralogix_alert" "test" {
Expand Down
16 changes: 8 additions & 8 deletions examples/alert/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ resource "coralogix_alert" "ratio_alert" {

notifications_group {
notification {
integration_id = coralogix_webhook.slack_webhook.id
integration_id = coralogix_webhook.slack_webhook.external_id
retriggering_period_minutes = 1
}
notification {
Expand Down Expand Up @@ -130,7 +130,7 @@ resource "coralogix_alert" "new_value_alert" {

notifications_group {
notification {
integration_id = coralogix_webhook.slack_webhook.id
integration_id = coralogix_webhook.slack_webhook.external_id
retriggering_period_minutes = 1
}
notification {
Expand Down Expand Up @@ -165,7 +165,7 @@ resource "coralogix_alert" "time_relative_alert" {

notifications_group {
notification {
integration_id = coralogix_webhook.slack_webhook.id
integration_id = coralogix_webhook.slack_webhook.external_id
retriggering_period_minutes = 1
}
notification {
Expand Down Expand Up @@ -201,7 +201,7 @@ resource "coralogix_alert" "metric_lucene_alert" {

notifications_group {
notification {
integration_id = coralogix_webhook.slack_webhook.id
integration_id = coralogix_webhook.slack_webhook.external_id
retriggering_period_minutes = 60
}
notification {
Expand Down Expand Up @@ -247,7 +247,7 @@ resource "coralogix_alert" "metric_promql_alert" {

notifications_group {
notification {
integration_id = coralogix_webhook.slack_webhook.id
integration_id = coralogix_webhook.slack_webhook.external_id
retriggering_period_minutes = 1
}
notification {
Expand Down Expand Up @@ -288,7 +288,7 @@ resource "coralogix_alert" "unique_count_alert" {
notifications_group {
group_by_fields = ["coralogix.metadata.sdkId"]
notification {
integration_id = coralogix_webhook.slack_webhook.id
integration_id = coralogix_webhook.slack_webhook.external_id
retriggering_period_minutes = 1
}
notification {
Expand Down Expand Up @@ -332,7 +332,7 @@ resource "coralogix_alert" "tracing_alert" {
}
notification {
notify_on = "Triggered_and_resolved"
integration_id = coralogix_webhook.slack_webhook.id
integration_id = coralogix_webhook.slack_webhook.external_id
retriggering_period_minutes = 1
}
}
Expand Down Expand Up @@ -389,7 +389,7 @@ resource "coralogix_alert" "flow_alert" {
}
notification {
notify_on = "Triggered_and_resolved"
integration_id = coralogix_webhook.slack_webhook.id
integration_id = coralogix_webhook.slack_webhook.external_id
retriggering_period_minutes = 1
}
}
Expand Down

0 comments on commit 820d22f

Please sign in to comment.