Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sysdig/internal/client/v2/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ type NotificationChannelConfigV2 struct {
}

type NotificationChannelOptionsV2 struct {
NotifyOnAcknowledge bool `json:"notifyOnAcknowledge,omitempty"`
NotifyOnAcknowledge *bool `json:"notifyOnAcknowledge,omitempty"`
NotifyOnResolve bool `json:"notifyOnResolve"`
ReNotifyEverySec *int `json:"reNotifyEverySec"`
CustomNotificationTemplate *CustomNotificationTemplateV2 `json:"customNotificationTemplate,omitempty"`
Expand Down
23 changes: 23 additions & 0 deletions sysdig/resource_sysdig_monitor_alert_v2_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ func createAlertV2Schema(original map[string]*schema.Schema) map[string]*schema.
Optional: true,
Default: true,
},
"notify_on_acknowledge": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"true", "false"}, false),
},
Comment thread
dbonf marked this conversation as resolved.
"main_threshold": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -262,6 +267,16 @@ func buildAlertV2CommonStruct(d *schema.ResourceData) *v2.AlertV2Common {
}

newChannel.OverrideOptions.NotifyOnResolve = channelMap["notify_on_resolve"].(bool)
if notifyOnAcknowledge, ok := channelMap["notify_on_acknowledge"]; ok && notifyOnAcknowledge.(string) != "" {
if notifyOnAcknowledge.(string) == "true" {
trueValue := true
newChannel.OverrideOptions.NotifyOnAcknowledge = &trueValue
} else {
falseValue := false
newChannel.OverrideOptions.NotifyOnAcknowledge = &falseValue
}
// else do not set any value for newChannel.OverrideOptions.NotifyOnAcknowledge
}

newChannel.OverrideOptions.Thresholds = []string{}
mainThreshold := channelMap["main_threshold"].(bool)
Expand Down Expand Up @@ -358,6 +373,14 @@ func updateAlertV2CommonState(d *schema.ResourceData, alert *v2.AlertV2Common) (
"notify_on_resolve": ncc.OverrideOptions.NotifyOnResolve,
}

if ncc.OverrideOptions.NotifyOnAcknowledge != nil {
if *ncc.OverrideOptions.NotifyOnAcknowledge {
config["notify_on_acknowledge"] = "true"
} else {
config["notify_on_acknowledge"] = "false"
}
}

if ncc.OverrideOptions.ReNotifyEverySec != nil {
config["renotify_every_minutes"] = secondsToMinutes(*ncc.OverrideOptions.ReNotifyEverySec)
} else {
Expand Down
14 changes: 8 additions & 6 deletions sysdig/resource_sysdig_monitor_notification_channel_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ func createMonitorNotificationChannelSchema(original map[string]*schema.Schema)
Default: false,
},
"notify_when_ok": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Type: schema.TypeBool,
Optional: true,
Default: false,
Deprecated: "The notify_when_ok field is deprecated and will be removed in a future version. This flag has been replaced by the `notify_on_resolve` field inside `notification_channels` when defining an alert resource.",
},
"notify_when_resolved": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Type: schema.TypeBool,
Optional: true,
Default: false,
Deprecated: "The notify_when_resolved field is deprecated and will be removed in a future version. This flag has been replaced by the `notify_on_acknowledge` field inside `notification_channels` when defining an alert resource.",
},
"version": {
Type: schema.TypeInt,
Expand Down
14 changes: 8 additions & 6 deletions sysdig/resource_sysdig_secure_notification_channel_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ func createSecureNotificationChannelSchema(original map[string]*schema.Schema) m
Default: false,
},
"notify_when_ok": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Type: schema.TypeBool,
Optional: true,
Default: false,
Deprecated: "The notify_when_ok field is deprecated and will be removed in a future version. This flag has been replaced by the `notify_on_resolve` field inside `notification_channels` when defining an alert resource.",
},
"notify_when_resolved": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Type: schema.TypeBool,
Optional: true,
Default: false,
Deprecated: "The notify_when_resolved field is deprecated and will be removed in a future version. This flag has been replaced by the `notify_on_acknowledge` field inside `notification_channels` when defining an alert resource.",
},
"version": {
Type: schema.TypeInt,
Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/monitor_alert_v2_change.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ By defining this field, the user can choose to which notification channels send
It is a list of objects with the following fields:
* `id` - (Required) The ID of the notification channel.
* `renotify_every_minutes` - (Optional) the amount of minutes to wait before re sending the notification to this channel. `0` means no renotification enabled. Default: `0`.
* `notify_on_resolve` - (Optional) Wether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_resolve` - (Optional) Whether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_acknowledge` - (Optional) Whether to send a notification when the alert is acknowledged. If not defined, this option is inherited from the `notify_when_resolved` option from the specific notification channel selected.
* `main_threshold` - (Optional) Whether this notification channel is used for the main threshold of the alert. Default: `true`.
* `warning_threshold` - (Optional) Whether this notification channel is used for the warning threshold of the alert. Default: `false`.

Expand Down
5 changes: 3 additions & 2 deletions website/docs/r/monitor_alert_v2_downtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ By defining this field, the user can choose to which notification channels send
It is a list of objects with the following fields:
* `id` - (Required) The ID of the notification channel.
* `renotify_every_minutes` - (Optional) the amount of minutes to wait before re sending the notification to this channel. `0` means no renotification enabled. Default: `0`.
* `notify_on_resolve` - (Optional) Wether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_resolve` - (Optional) Whether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_acknowledge` - (Optional) Whether to send a notification when the alert is acknowledged. If not defined, this option is inherited from the `notify_when_resolved` option from the specific notification channel selected.

### `custom_notification`

Expand Down Expand Up @@ -94,7 +95,7 @@ Enables the creation of a capture file of the syscalls during the event.
* `duration_seconds` - (Optional) Time frame of the capture. Default: `15`.
* `storage` - (Optional) Custom bucket where to save the capture.
* `filter` - (Optional) Additional filter to apply to the capture. For example: `proc.name contains nginx`.
* `enabled` - (Optional) Wether to enable captures. Default: `true`.
* `enabled` - (Optional) Whether to enable captures. Default: `true`.

### Downtime alert arguments

Expand Down
5 changes: 3 additions & 2 deletions website/docs/r/monitor_alert_v2_event.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ By defining this field, the user can choose to which notification channels send
It is a list of objects with the following fields:
* `id` - (Required) The ID of the notification channel.
* `renotify_every_minutes` - (Optional) the amount of minutes to wait before re sending the notification to this channel. `0` means no renotification enabled. Default: `0`.
* `notify_on_resolve` - (Optional) Wether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_resolve` - (Optional) Whether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_acknowledge` - (Optional) Whether to send a notification when the alert is acknowledged. If not defined, this option is inherited from the `notify_when_resolved` option from the specific notification channel selected.
* `main_threshold` - (Optional) Whether this notification channel is used for the main threshold of the alert. Default: `true`.
* `warning_threshold` - (Optional) Whether this notification channel is used for the warning threshold of the alert. Default: `false`.

Expand Down Expand Up @@ -106,7 +107,7 @@ Enables the creation of a capture file of the syscalls during the event.
* `duration_seconds` - (Optional) Time frame of the capture. Default: `15`.
* `storage` - (Optional) Custom bucket where to save the capture.
* `filter` - (Optional) Additional filter to apply to the capture. For example: `proc.name contains nginx`.
* `enabled` - (Optional) Wether to enable captures. Default: `true`.
* `enabled` - (Optional) Whether to enable captures. Default: `true`.

### Event alert arguments

Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/monitor_alert_v2_form_based_prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ By defining this field, the user can choose to which notification channels send
It is a list of objects with the following fields:
* `id` - (Required) The ID of the notification channel.
* `renotify_every_minutes` - (Optional) the amount of minutes to wait before re sending the notification to this channel. `0` means no renotification enabled.
* `notify_on_resolve` - (Optional) Wether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_resolve` - (Optional) Whether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_acknowledge` - (Optional) Whether to send a notification when the alert is acknowledged. If not defined, this option is inherited from the `notify_when_resolved` option from the specific notification channel selected.
* `main_threshold` - (Optional) Whether this notification channel is used for the main threshold of the alert. Default: `true`.
* `warning_threshold` - (Optional) Whether this notification channel is used for the warning threshold of the alert. Default: `false`.

Expand Down
5 changes: 3 additions & 2 deletions website/docs/r/monitor_alert_v2_group_outlier.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ By defining this field, the user can choose to which notification channels send
It is a list of objects with the following fields:
* `id` - (Required) The ID of the notification channel.
* `renotify_every_minutes` - (Optional) the amount of minutes to wait before re sending the notification to this channel. `0` means no renotification enabled. Default: `0`.
* `notify_on_resolve` - (Optional) Wether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_resolve` - (Optional) Whether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_acknowledge` - (Optional) Whether to send a notification when the alert is acknowledged. If not defined, this option is inherited from the `notify_when_resolved` option from the specific notification channel selected.
* `main_threshold` - (Optional) Whether this notification channel is used for the main threshold of the alert. Default: `true`.
* `warning_threshold` - (Optional) Whether this notification channel is used for the warning threshold of the alert. Default: `false`.

Expand Down Expand Up @@ -108,7 +109,7 @@ Enables the creation of a capture file of the syscalls during the event.
* `duration_seconds` - (Optional) Time frame of the capture. Default: `15`.
* `storage` - (Optional) Custom bucket where to save the capture.
* `filter` - (Optional) Additional filter to apply to the capture. For example: `proc.name contains nginx`.
* `enabled` - (Optional) Wether to enable captures. Default: `true`.
* `enabled` - (Optional) Whether to enable captures. Default: `true`.

### Group Outlier alert arguments

Expand Down
5 changes: 3 additions & 2 deletions website/docs/r/monitor_alert_v2_metric.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ By defining this field, the user can choose to which notification channels send
It is a list of objects with the following fields:
* `id` - (Required) The ID of the notification channel.
* `renotify_every_minutes` - (Optional) the amount of minutes to wait before re sending the notification to this channel. `0` means no renotification enabled. Default: `0`.
* `notify_on_resolve` - (Optional) Wether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_resolve` - (Optional) Whether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_acknowledge` - (Optional) Whether to send a notification when the alert is acknowledged. If not defined, this option is inherited from the `notify_when_resolved` option from the specific notification channel selected.
* `main_threshold` - (Optional) Whether this notification channel is used for the main threshold of the alert. Default: `true`.
* `warning_threshold` - (Optional) Whether this notification channel is used for the warning threshold of the alert. Default: `false`.

Expand Down Expand Up @@ -123,7 +124,7 @@ Enables the creation of a capture file of the syscalls during the event.
* `duration_seconds` - (Optional) Time frame of the capture. Default: `15`.
* `storage` - (Optional) Custom bucket where to save the capture.
* `filter` - (Optional) Additional filter to apply to the capture. For example: `proc.name contains nginx`.
* `enabled` - (Optional) Wether to enable captures. Default: `true`.
* `enabled` - (Optional) Whether to enable captures. Default: `true`.

### Metric Threshold alert arguments

Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/monitor_alert_v2_prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ By defining this field, the user can choose to which notification channels send
It is a list of objects with the following fields:
* `id` - (Required) The ID of the notification channel.
* `renotify_every_minutes` - (Optional) the amount of minutes to wait before re sending the notification to this channel. `0` means no renotification enabled.
* `notify_on_resolve` - (Optional) Wether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_resolve` - (Optional) Whether to send a notification when the alert is resolved. Default: `true`.
* `notify_on_acknowledge` - (Optional) Whether to send a notification when the alert is acknowledged. If not defined, this option is inherited from the `notify_when_resolved` option from the specific notification channel selected.

### `custom_notification`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ resource "sysdig_monitor_notification_channel_custom_webhook" "sample-custom-web
"custom-Header": "TestHeader"
}

notify_when_ok = false
notify_when_resolved = false
send_test_notification = false
}
```
Expand All @@ -48,11 +46,9 @@ resource "sysdig_monitor_notification_channel_custom_webhook" "sample-custom-web

* `enabled` - (Optional) If false, the channel will not emit notifications. Default is true.

* `notify_when_ok` - (Optional) Send a new notification when the alert condition is
no longer triggered. Default is false.
* `notify_when_ok` - (Optional, Deprecated) Send a new notification when the alert condition is no longer triggered. Default is `false`. This option is deprecated; use `notify_on_resolve` within the `notification_channels` options in the `sysdig_monitor_alert_v2_*` resources instead, which takes precedence over this setting.

* `notify_when_resolved` - (Optional) Send a new notification when the alert is manually
acknowledged by a user. Default is false.
* `notify_when_resolved` - (Optional, Deprecated) Send a new notification when the alert is manually acknowledged by a user. Default is `false`. This option is deprecated; use `notify_on_acknowledge` within the `notification_channels` options in the `sysdig_monitor_alert_v2_*` resources instead, which takes precedence over this setting.

* `send_test_notification` - (Optional) Send an initial test notification to check
if the notification channel is working. Default is false.
Expand Down
8 changes: 2 additions & 6 deletions website/docs/r/monitor_notification_channel_email.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ resource "sysdig_monitor_notification_channel_email" "sample_email" {
name = "Example Channel - Email"
recipients = ["foo@localhost.com", "bar@localhost.com"]
enabled = true
notify_when_ok = false
notify_when_resolved = false
send_test_notification = false
}
```
Expand All @@ -34,11 +32,9 @@ resource "sysdig_monitor_notification_channel_email" "sample_email" {

* `enabled` - (Optional) If false, the channel will not emit notifications. Default is true.

* `notify_when_ok` - (Optional) Send a new notification when the alert condition is
no longer triggered. Default is false.
* `notify_when_ok` - (Optional, Deprecated) Send a new notification when the alert condition is no longer triggered. Default is `false`. This option is deprecated; use `notify_on_resolve` within the `notification_channels` options in the `sysdig_monitor_alert_v2_*` resources instead, which takes precedence over this setting.

* `notify_when_resolved` - (Optional) Send a new notification when the alert is manually
acknowledged by a user. Default is false.
* `notify_when_resolved` - (Optional, Deprecated) Send a new notification when the alert is manually acknowledged by a user. Default is `false`. This option is deprecated; use `notify_on_acknowledge` within the `notification_channels` options in the `sysdig_monitor_alert_v2_*` resources instead, which takes precedence over this setting.

* `send_test_notification` - (Optional) Send an initial test notification to check
if the notification channel is working. Default is false.
Expand Down
8 changes: 2 additions & 6 deletions website/docs/r/monitor_notification_channel_google_chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ resource "sysdig_monitor_notification_channel_google_chat" "sample-gchat" {
name = "Example Channel - google chat"
enabled = true
url = "https://chat.googleapis.com/v1/spaces/XXXXXX/messages?key=XXXXXXXXXXXXXXXXX"
notify_when_ok = false
notify_when_resolved = false
share_with_current_team = true
}
```
Expand All @@ -33,11 +31,9 @@ resource "sysdig_monitor_notification_channel_google_chat" "sample-gchat" {

* `enabled` - (Optional) If false, the channel will not emit notifications. Default is true.

* `notify_when_ok` - (Optional) Send a new notification when the alert condition is
no longer triggered. Default is false.
* `notify_when_ok` - (Optional, Deprecated) Send a new notification when the alert condition is no longer triggered. Default is `false`. This option is deprecated; use `notify_on_resolve` within the `notification_channels` options in the `sysdig_monitor_alert_v2_*` resources instead, which takes precedence over this setting.

* `notify_when_resolved` - (Optional) Send a new notification when the alert is manually
acknowledged by a user. Default is false.
* `notify_when_resolved` - (Optional, Deprecated) Send a new notification when the alert is manually acknowledged by a user. Default is `false`. This option is deprecated; use `notify_on_acknowledge` within the `notification_channels` options in the `sysdig_monitor_alert_v2_*` resources instead, which takes precedence over this setting.

* `send_test_notification` - (Optional) Send an initial test notification to check
if the notification channel is working. Default is false.
Expand Down
Loading
Loading