Skip to content

Commit 061b4c4

Browse files
committed
fix interval_min plan modifier
1 parent 1f73c50 commit 061b4c4

File tree

2 files changed

+56
-4
lines changed

2 files changed

+56
-4
lines changed

internal/service/alertconfiguration/resource_alert_configuration.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,6 @@ func (r *alertConfigurationRS) Schema(ctx context.Context, req resource.SchemaRe
283283
"interval_min": schema.Int64Attribute{
284284
Optional: true,
285285
Computed: true,
286-
PlanModifiers: []planmodifier.Int64{
287-
int64planmodifier.UseStateForUnknown(),
288-
},
289286
},
290287
"mobile_number": schema.StringAttribute{
291288
Optional: true,

internal/service/alertconfiguration/resource_alert_configuration_test.go

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@ func datadogTestCase(t *testing.T) *resource.TestCase {
430430
},
431431
}
432432
}
433-
434433
func TestAccConfigRSAlertConfiguration_withPagerDuty(t *testing.T) {
435434
proxyPort := replay.SetupReplayProxy(t)
436435

@@ -464,6 +463,46 @@ func TestAccConfigRSAlertConfiguration_withPagerDuty(t *testing.T) {
464463
})
465464
}
466465

466+
func TestAccConfigRSAlertConfiguration_withEmailToPagerDuty(t *testing.T) {
467+
proxyPort := replay.SetupReplayProxy(t)
468+
469+
var (
470+
projectID = replay.ManageProjectID(t, acc.ProjectIDExecution)
471+
serviceKey = dummy32CharKey
472+
)
473+
474+
resource.ParallelTest(t, resource.TestCase{
475+
PreCheck: func() { acc.PreCheckBasic(t) },
476+
ProtoV6ProviderFactories: acc.TestAccProviderV6FactoriesWithProxy(proxyPort),
477+
CheckDestroy: checkDestroyUsingProxy(proxyPort),
478+
Steps: []resource.TestStep{
479+
{
480+
Config: configWithEmail(projectID, true),
481+
Check: resource.ComposeAggregateTestCheckFunc(
482+
checkExistsUsingProxy(proxyPort, resourceName),
483+
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
484+
),
485+
},
486+
{
487+
Config: configWithPagerDuty(projectID, serviceKey, true),
488+
Check: resource.ComposeAggregateTestCheckFunc(
489+
checkExistsUsingProxy(proxyPort, resourceName),
490+
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
491+
),
492+
},
493+
{
494+
ResourceName: resourceName,
495+
ImportStateIdFunc: importStateProjectIDFunc(resourceName),
496+
ImportState: true,
497+
ImportStateVerify: true,
498+
// service key is not returned by api in import operation
499+
// integration_id is not returned during Create
500+
ImportStateVerifyIgnore: []string{"updated", "notification.0.service_key", "notification.0.integration_id"},
501+
},
502+
},
503+
})
504+
}
505+
467506
func TestAccConfigAlertConfiguration_PagerDutyUsingIntegrationID(t *testing.T) {
468507
// create a new project as it need to ensure no third party integration has already been created
469508
var (
@@ -848,6 +887,22 @@ func configWithPagerDuty(projectID, serviceKey string, enabled bool) string {
848887
`, projectID, serviceKey, enabled)
849888
}
850889

890+
func configWithEmail(projectID string, enabled bool) string {
891+
return fmt.Sprintf(`
892+
resource "mongodbatlas_alert_configuration" "test" {
893+
project_id = %[1]q
894+
enabled = %[2]t
895+
event_type = "NO_PRIMARY"
896+
897+
notification {
898+
type_name = "EMAIL"
899+
interval_min = 60
900+
email_address = "test@mongodbtest.com"
901+
}
902+
}
903+
`, projectID, enabled)
904+
}
905+
851906
func configWithPagerDutyIntegrationID(orgID, projectName, serviceKey string) string {
852907
return fmt.Sprintf(`
853908
resource "mongodbatlas_project" "test" {

0 commit comments

Comments
 (0)