From f822fa937edda02d80e7440db8896b360227cefd Mon Sep 17 00:00:00 2001 From: Diego Bonfigli Date: Fri, 1 Aug 2025 15:36:45 +0200 Subject: [PATCH] fix(notification channels): avoid drift on send_test_notification = true --- ...source_sysdig_monitor_alert_metric_test.go | 13 +++---- ...dig_monitor_notification_channel_common.go | 2 +- ...otification_channel_custom_webhook_test.go | 35 +++++++++++-------- ...monitor_notification_channel_email_test.go | 7 ++-- ...r_notification_channel_google_chat_test.go | 14 ++++---- ...ion_channel_ibm_event_notification_test.go | 14 ++++---- ...nitor_notification_channel_msteams_test.go | 14 ++++---- ...itor_notification_channel_opsgenie_test.go | 21 ++++++----- ...tor_notification_channel_pagerduty_test.go | 7 ++-- ...n_channel_prometheus_alert_manager_test.go | 28 ++++++++------- ...monitor_notification_channel_slack_test.go | 21 ++++++----- ...g_monitor_notification_channel_sns_test.go | 7 ++-- ...or_notification_channel_team_email_test.go | 14 ++++---- ...tor_notification_channel_victorops_test.go | 7 ++-- ...nitor_notification_channel_webhook_test.go | 35 +++++++++++-------- ...sdig_secure_notification_channel_common.go | 2 +- ..._secure_notification_channel_email_test.go | 7 ++-- ...ecure_notification_channel_msteams_test.go | 7 ++-- ...cure_notification_channel_opsgenie_test.go | 21 ++++++----- ...ure_notification_channel_pagerduty_test.go | 7 ++-- ...n_channel_prometheus_alert_manager_test.go | 28 ++++++++------- ..._secure_notification_channel_slack_test.go | 14 ++++---- ...ig_secure_notification_channel_sns_test.go | 7 ++-- ...re_notification_channel_team_email_test.go | 14 ++++---- ...ure_notification_channel_victorops_test.go | 7 ++-- ...ecure_notification_channel_webhook_test.go | 28 ++++++++------- 26 files changed, 217 insertions(+), 164 deletions(-) diff --git a/sysdig/resource_sysdig_monitor_alert_metric_test.go b/sysdig/resource_sysdig_monitor_alert_metric_test.go index dc5292c6b..9d72c08ad 100644 --- a/sysdig/resource_sysdig_monitor_alert_metric_test.go +++ b/sysdig/resource_sysdig_monitor_alert_metric_test.go @@ -42,9 +42,10 @@ func TestAccAlertMetric(t *testing.T) { }, }, { - ResourceName: "sysdig_secure_notification_channel_pagerduty.sample-pagerduty", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_pagerduty.sample-pagerduty", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, SkipFunc: func() (bool, error) { return buildinfo.IBMMonitor, nil }, @@ -62,7 +63,7 @@ resource "sysdig_monitor_alert_metric" "sample" { metric = "avg(avg(cpu.used.percent)) > 50" scope = "agent.id in (\"foo\")" - + trigger_after_minutes = 10 enabled = false @@ -86,7 +87,7 @@ resource "sysdig_monitor_alert_metric" "sample" { metric = "avg(avg(cpu.used.percent)) > 50" scope = "agent.id in (\"foo\")" - + trigger_after_minutes = 10 group_name = "sample_group_name" enabled = false @@ -109,7 +110,7 @@ resource "sysdig_monitor_alert_metric" "sample2" { severity = 3 metric = "avg(avg(cpu.used.percent)) > 50" - + trigger_after_minutes = 10 enabled = false diff --git a/sysdig/resource_sysdig_monitor_notification_channel_common.go b/sysdig/resource_sysdig_monitor_notification_channel_common.go index 51682a2a4..c8dfcf903 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_common.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_common.go @@ -84,7 +84,7 @@ func monitorNotificationChannelToResourceData(nc *v2.NotificationChannel, data * } _ = data.Set("notify_when_ok", nc.Options.NotifyOnOk) _ = data.Set("notify_when_resolved", nc.Options.NotifyOnResolve) - _ = data.Set("send_test_notification", nc.Options.SendTestNotification) + // do not update "send_test_notification" from the api response as it will always be "false" on subsequent reads because the fields is not persisted return } diff --git a/sysdig/resource_sysdig_monitor_notification_channel_custom_webhook_test.go b/sysdig/resource_sysdig_monitor_notification_channel_custom_webhook_test.go index d73154454..bd7eb8d97 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_custom_webhook_test.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_custom_webhook_test.go @@ -28,41 +28,46 @@ func TestAccMonitorNotificationChannelCustomWebhook(t *testing.T) { Config: monitorNotificationChannelCustomWebhookWithName(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_custom_webhook.sample-custom-webhook1", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_custom_webhook.sample-custom-webhook1", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelCustomWebhookWithNameWithAdditionalheaders(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_custom_webhook.sample-custom-webhook2", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_custom_webhook.sample-custom-webhook2", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelCustomWebhookSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_custom_webhook.sample-custom-webhook3", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_custom_webhook.sample-custom-webhook3", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelCustomWebhookSharedWithAllowInsecureConnections(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_custom_webhook.sample-custom-webhook4", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_custom_webhook.sample-custom-webhook4", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelCustomWebhookSharedWithAdditionalHeaders(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_custom_webhook.sample-custom-webhook5", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_custom_webhook.sample-custom-webhook5", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_monitor_notification_channel_email_test.go b/sysdig/resource_sysdig_monitor_notification_channel_email_test.go index a7af499d9..66ab25dd8 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_email_test.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_email_test.go @@ -34,9 +34,10 @@ func TestAccMonitorNotificationChannelEmail(t *testing.T) { Config: monitorNotificationChannelEmailSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_email.sample_email", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_email.sample_email", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_monitor_notification_channel_google_chat_test.go b/sysdig/resource_sysdig_monitor_notification_channel_google_chat_test.go index bca990cb2..2f98e6d48 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_google_chat_test.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_google_chat_test.go @@ -28,17 +28,19 @@ func TestAccMonitorNotificationChannelGoogleChat(t *testing.T) { Config: monitorNotificationChannelGoogleChatWithName(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_google_chat.sample_google_chat1", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_google_chat.sample_google_chat1", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelGoogleChatSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_google_chat.sample_google_chat2", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_google_chat.sample_google_chat2", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_monitor_notification_channel_ibm_event_notification_test.go b/sysdig/resource_sysdig_monitor_notification_channel_ibm_event_notification_test.go index 75faf0c79..ddaf94909 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_ibm_event_notification_test.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_ibm_event_notification_test.go @@ -35,17 +35,19 @@ func TestAccMonitorNotificationChannelIBMEventNotification(t *testing.T) { Config: monitorNotificationChannelIBMEventNotificationWithName(rText(), ibmEventNotificationInstanceId), }, { - ResourceName: "sysdig_monitor_notification_channel_ibm_event_notification.sample1", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_ibm_event_notification.sample1", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelIBMEventNotificationSharedWithCurrentTeam(rText(), ibmEventNotificationInstanceId), }, { - ResourceName: "sysdig_monitor_notification_channel_ibm_event_notification.sample2", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_ibm_event_notification.sample2", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_monitor_notification_channel_msteams_test.go b/sysdig/resource_sysdig_monitor_notification_channel_msteams_test.go index e1d478e2e..e427cea29 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_msteams_test.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_msteams_test.go @@ -28,17 +28,19 @@ func TestAccMonitorNotificationChannelMSTeams(t *testing.T) { Config: monitorNotificationChannelMSTeamsWithName(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_msteams.sample-msteams1", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_msteams.sample-msteams1", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelMSTeamsSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_msteams.sample-msteams2", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_msteams.sample-msteams2", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_monitor_notification_channel_opsgenie_test.go b/sysdig/resource_sysdig_monitor_notification_channel_opsgenie_test.go index 0c1444231..b7cade4ea 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_opsgenie_test.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_opsgenie_test.go @@ -29,25 +29,28 @@ func TestAccMonitorNotificationChannelOpsGenie(t *testing.T) { Config: monitorNotificationChannelOpsGenieWithName(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_opsgenie.sample-opsgenie", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_opsgenie.sample-opsgenie", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelOpsGenieWithNameAndRegion(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_opsgenie.sample-opsgenie-2", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_opsgenie.sample-opsgenie-2", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelOpsGenieSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_opsgenie.sample-opsgenie-3", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_opsgenie.sample-opsgenie-3", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_monitor_notification_channel_pagerduty_test.go b/sysdig/resource_sysdig_monitor_notification_channel_pagerduty_test.go index d8040bb63..9fccea0c4 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_pagerduty_test.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_pagerduty_test.go @@ -32,9 +32,10 @@ func TestAccMonitorNotificationChannelPagerduty(t *testing.T) { Config: monitorNotificationChannelPagerdutySharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_pagerduty.sample-pagerduty", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_pagerduty.sample-pagerduty", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_monitor_notification_channel_prometheus_alert_manager_test.go b/sysdig/resource_sysdig_monitor_notification_channel_prometheus_alert_manager_test.go index bcb732267..4cb86d6c8 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_prometheus_alert_manager_test.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_prometheus_alert_manager_test.go @@ -28,33 +28,37 @@ func TestAccMonitorNotificationChannelPrometheusAlertManager(t *testing.T) { Config: monitorNotificationChannelPrometheusAlertManagerWithName(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_prometheus_alert_manager.sample-channel1", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_prometheus_alert_manager.sample-channel1", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelPrometheusAlertManagerWithNameWithAdditionalheaders(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_prometheus_alert_manager.sample-channel2", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_prometheus_alert_manager.sample-channel2", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelPrometheusAlertManagerWithNameWithAllowInsecureConnections(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_prometheus_alert_manager.sample-channel3", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_prometheus_alert_manager.sample-channel3", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelPrometheusAlertManagerSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_prometheus_alert_manager.sample-channel4", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_prometheus_alert_manager.sample-channel4", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_monitor_notification_channel_slack_test.go b/sysdig/resource_sysdig_monitor_notification_channel_slack_test.go index 75b1b0148..46e53cfae 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_slack_test.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_slack_test.go @@ -31,25 +31,28 @@ func TestAccMonitorNotificationChannelSlack(t *testing.T) { Config: monitorNotificationChannelSlackSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_slack.sample-slack", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_slack.sample-slack", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelSlackSharedWithShowSection(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_slack.sample-slack", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_slack.sample-slack", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelSlackSharedWithPrivateChannel(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_slack.sample-slack-private", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_slack.sample-slack-private", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_monitor_notification_channel_sns_test.go b/sysdig/resource_sysdig_monitor_notification_channel_sns_test.go index bcee11352..8292ad8d1 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_sns_test.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_sns_test.go @@ -31,9 +31,10 @@ func TestAccMonitorNotificationChannelSNS(t *testing.T) { Config: monitorNotificationChannelAmazonSNSShareWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_sns.sample-amazon-sns", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_sns.sample-amazon-sns", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_monitor_notification_channel_team_email_test.go b/sysdig/resource_sysdig_monitor_notification_channel_team_email_test.go index b866b140b..11f8529e5 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_team_email_test.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_team_email_test.go @@ -28,17 +28,19 @@ func TestAccMonitorNotificationChannelTeamEmail(t *testing.T) { Config: monitorNotificationChannelTeamEmailWithName(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_team_email.sample_team_email1", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_team_email.sample_team_email1", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelTeamEmailSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_team_email.sample_team_email2", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_team_email.sample_team_email2", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_monitor_notification_channel_victorops_test.go b/sysdig/resource_sysdig_monitor_notification_channel_victorops_test.go index 197d7811f..1a4c7e957 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_victorops_test.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_victorops_test.go @@ -31,9 +31,10 @@ func TestAccMonitorNotificationChannelVictorOps(t *testing.T) { Config: monitorNotificationChannelVictorOpsShareWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_victorops.sample-victorops", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_victorops.sample-victorops", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_monitor_notification_channel_webhook_test.go b/sysdig/resource_sysdig_monitor_notification_channel_webhook_test.go index cd3f36f08..1468f4de9 100644 --- a/sysdig/resource_sysdig_monitor_notification_channel_webhook_test.go +++ b/sysdig/resource_sysdig_monitor_notification_channel_webhook_test.go @@ -28,41 +28,46 @@ func TestAccMonitorNotificationChannelWebhook(t *testing.T) { Config: monitorNotificationChannelWebhookWithName(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_webhook.sample-webhook", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_webhook.sample-webhook", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelWebhookWithNameWithAdditionalheaders(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_webhook.sample-webhook2", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_webhook.sample-webhook2", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelWebhookSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_webhook.sample-webhook3", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_webhook.sample-webhook3", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelWebhookSharedWithAllowInsecureConnections(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_webhook.sample-webhook4", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_webhook.sample-webhook4", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: monitorNotificationChannelWebhookSharedWithCustomData(rText()), }, { - ResourceName: "sysdig_monitor_notification_channel_webhook.sample-webhook5", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_monitor_notification_channel_webhook.sample-webhook5", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_secure_notification_channel_common.go b/sysdig/resource_sysdig_secure_notification_channel_common.go index 8baa07183..da8bd579d 100644 --- a/sysdig/resource_sysdig_secure_notification_channel_common.go +++ b/sysdig/resource_sysdig_secure_notification_channel_common.go @@ -84,7 +84,7 @@ func secureNotificationChannelToResourceData(nc *v2.NotificationChannel, data *s } _ = data.Set("notify_when_ok", nc.Options.NotifyOnOk) _ = data.Set("notify_when_resolved", nc.Options.NotifyOnResolve) - _ = data.Set("send_test_notification", nc.Options.SendTestNotification) + // do not update "send_test_notification" from the api response as it will always be "false" on subsequent reads because the fields is not persisted return } diff --git a/sysdig/resource_sysdig_secure_notification_channel_email_test.go b/sysdig/resource_sysdig_secure_notification_channel_email_test.go index d489e3334..8523af3fa 100644 --- a/sysdig/resource_sysdig_secure_notification_channel_email_test.go +++ b/sysdig/resource_sysdig_secure_notification_channel_email_test.go @@ -35,9 +35,10 @@ func TestAccSecureNotificationChannelEmail(t *testing.T) { Config: secureNotificationChannelEmailSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_email.sample_email", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_email.sample_email", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_secure_notification_channel_msteams_test.go b/sysdig/resource_sysdig_secure_notification_channel_msteams_test.go index a42046b14..41cbeec64 100644 --- a/sysdig/resource_sysdig_secure_notification_channel_msteams_test.go +++ b/sysdig/resource_sysdig_secure_notification_channel_msteams_test.go @@ -44,9 +44,10 @@ func TestAccSecureNotificationChannelMSTeams(t *testing.T) { ), }, { - ResourceName: "sysdig_secure_notification_channel_msteams.sample-msteams", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_msteams.sample-msteams", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_secure_notification_channel_opsgenie_test.go b/sysdig/resource_sysdig_secure_notification_channel_opsgenie_test.go index 8e816504a..871fbeffd 100644 --- a/sysdig/resource_sysdig_secure_notification_channel_opsgenie_test.go +++ b/sysdig/resource_sysdig_secure_notification_channel_opsgenie_test.go @@ -29,25 +29,28 @@ func TestAccSecureNotificationChannelOpsGenie(t *testing.T) { Config: secureNotificationChannelOpsGenieWithName(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_opsgenie.sample-opsgenie", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_opsgenie.sample-opsgenie", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: secureNotificationChannelOpsGenieWithNameAndRegion(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_opsgenie.sample-opsgenie-2", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_opsgenie.sample-opsgenie-2", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: secureNotificationChannelOpsGenieSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_opsgenie.sample-opsgenie-3", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_opsgenie.sample-opsgenie-3", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_secure_notification_channel_pagerduty_test.go b/sysdig/resource_sysdig_secure_notification_channel_pagerduty_test.go index 58c9445de..a8da03f65 100644 --- a/sysdig/resource_sysdig_secure_notification_channel_pagerduty_test.go +++ b/sysdig/resource_sysdig_secure_notification_channel_pagerduty_test.go @@ -32,9 +32,10 @@ func TestAccSecureNotificationChannelPagerduty(t *testing.T) { Config: secureNotificationChannelPagerdutySharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_pagerduty.sample-pagerduty", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_pagerduty.sample-pagerduty", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_secure_notification_channel_prometheus_alert_manager_test.go b/sysdig/resource_sysdig_secure_notification_channel_prometheus_alert_manager_test.go index 925cab19f..68a850dfa 100644 --- a/sysdig/resource_sysdig_secure_notification_channel_prometheus_alert_manager_test.go +++ b/sysdig/resource_sysdig_secure_notification_channel_prometheus_alert_manager_test.go @@ -28,33 +28,37 @@ func TestAccSecureNotificationChannelPrometheusAlertManager(t *testing.T) { Config: secureNotificationChannelPrometheusAlertManagerWithName(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_prometheus_alert_manager.sample-channel1", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_prometheus_alert_manager.sample-channel1", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: secureNotificationChannelPrometheusAlertManagerWithNameWithAdditionalheaders(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_prometheus_alert_manager.sample-channel2", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_prometheus_alert_manager.sample-channel2", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: secureNotificationChannelPrometheusAlertManagerWithNameWithAllowInsecureConnections(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_prometheus_alert_manager.sample-channel3", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_prometheus_alert_manager.sample-channel3", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: secureNotificationChannelPrometheusAlertManagerSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_prometheus_alert_manager.sample-channel4", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_prometheus_alert_manager.sample-channel4", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_secure_notification_channel_slack_test.go b/sysdig/resource_sysdig_secure_notification_channel_slack_test.go index d4044c462..73a7c1ec7 100644 --- a/sysdig/resource_sysdig_secure_notification_channel_slack_test.go +++ b/sysdig/resource_sysdig_secure_notification_channel_slack_test.go @@ -44,17 +44,19 @@ func TestAccSecureNotificationChannelSlack(t *testing.T) { ), }, { - ResourceName: "sysdig_secure_notification_channel_slack.sample-slack", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_slack.sample-slack", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: secureNotificationChannelSlackSharedWithPrivateChannel(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_slack.sample-slack-private", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_slack.sample-slack-private", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_secure_notification_channel_sns_test.go b/sysdig/resource_sysdig_secure_notification_channel_sns_test.go index 62fb64863..833dc3d23 100644 --- a/sysdig/resource_sysdig_secure_notification_channel_sns_test.go +++ b/sysdig/resource_sysdig_secure_notification_channel_sns_test.go @@ -32,9 +32,10 @@ func TestAccSecureNotificationChannelSNS(t *testing.T) { Config: secureNotificationChannelAmazonSNSShareWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_sns.sample-amazon-sns", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_sns.sample-amazon-sns", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_secure_notification_channel_team_email_test.go b/sysdig/resource_sysdig_secure_notification_channel_team_email_test.go index 2e767b4d0..9e01847c2 100644 --- a/sysdig/resource_sysdig_secure_notification_channel_team_email_test.go +++ b/sysdig/resource_sysdig_secure_notification_channel_team_email_test.go @@ -28,17 +28,19 @@ func TestAccSecureNotificationChannelTeamEmail(t *testing.T) { Config: secureNotificationChannelTeamEmailWithName(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_team_email.sample_team_email1", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_team_email.sample_team_email1", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: secureNotificationChannelTeamEmailSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_team_email.sample_team_email2", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_team_email.sample_team_email2", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_secure_notification_channel_victorops_test.go b/sysdig/resource_sysdig_secure_notification_channel_victorops_test.go index 5c7f820a3..68ab650fe 100644 --- a/sysdig/resource_sysdig_secure_notification_channel_victorops_test.go +++ b/sysdig/resource_sysdig_secure_notification_channel_victorops_test.go @@ -32,9 +32,10 @@ func TestAccSecureNotificationChannelVictorOps(t *testing.T) { Config: secureNotificationChannelVictorOpsShareWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_victorops.sample-victorops", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_victorops.sample-victorops", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, }) diff --git a/sysdig/resource_sysdig_secure_notification_channel_webhook_test.go b/sysdig/resource_sysdig_secure_notification_channel_webhook_test.go index f87d8eda5..572d72aaf 100644 --- a/sysdig/resource_sysdig_secure_notification_channel_webhook_test.go +++ b/sysdig/resource_sysdig_secure_notification_channel_webhook_test.go @@ -29,33 +29,37 @@ func TestAccSecureNotificationChannelWebhook(t *testing.T) { Config: secureNotificationChannelWebhookWithName(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_webhook.sample-webhook", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_webhook.sample-webhook", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: secureNotificationChannelWebhookSharedWithCurrentTeam(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_webhook.sample-webhook3", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_webhook.sample-webhook3", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: secureNotificationChannelWebhookSharedWithAllowInsecureConnections(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_webhook.sample-webhook4", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_webhook.sample-webhook4", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, { Config: secureNotificationChannelWebhookSharedWithCustomData(rText()), }, { - ResourceName: "sysdig_secure_notification_channel_webhook.sample-webhook5", - ImportState: true, - ImportStateVerify: true, + ResourceName: "sysdig_secure_notification_channel_webhook.sample-webhook5", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"send_test_notification"}, }, }, })