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
13 changes: 7 additions & 6 deletions sysdig/resource_sysdig_monitor_alert_metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
})
Expand Down
Loading
Loading