-
Notifications
You must be signed in to change notification settings - Fork 190
fix: Removes interval_min
plan modifier to avoid error on update
#3051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
resource/mongodbatlas_alert_configuration: Removes UseStateForUnknown plan modifier for interval_min | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -430,7 +430,6 @@ func datadogTestCase(t *testing.T) *resource.TestCase { | |
}, | ||
} | ||
} | ||
|
||
func TestAccConfigRSAlertConfiguration_withPagerDuty(t *testing.T) { | ||
proxyPort := replay.SetupReplayProxy(t) | ||
|
||
|
@@ -464,6 +463,46 @@ func TestAccConfigRSAlertConfiguration_withPagerDuty(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccConfigRSAlertConfiguration_withEmailToPagerDuty(t *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice test case! |
||
proxyPort := replay.SetupReplayProxy(t) | ||
|
||
var ( | ||
projectID = replay.ManageProjectID(t, acc.ProjectIDExecution) | ||
serviceKey = dummy32CharKey | ||
) | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acc.PreCheckBasic(t) }, | ||
ProtoV6ProviderFactories: acc.TestAccProviderV6FactoriesWithProxy(proxyPort), | ||
CheckDestroy: checkDestroyUsingProxy(proxyPort), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: configWithEmail(projectID, true), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
checkExistsUsingProxy(proxyPort, resourceName), | ||
resource.TestCheckResourceAttr(resourceName, "project_id", projectID), | ||
), | ||
}, | ||
{ | ||
Config: configWithPagerDuty(projectID, serviceKey, true), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
checkExistsUsingProxy(proxyPort, resourceName), | ||
resource.TestCheckResourceAttr(resourceName, "project_id", projectID), | ||
), | ||
}, | ||
{ | ||
ResourceName: resourceName, | ||
ImportStateIdFunc: importStateProjectIDFunc(resourceName), | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
// service key is not returned by api in import operation | ||
oarbusi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// integration_id is not returned during Create | ||
ImportStateVerifyIgnore: []string{"updated", "notification.0.service_key", "notification.0.integration_id"}, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccConfigAlertConfiguration_PagerDutyUsingIntegrationID(t *testing.T) { | ||
// create a new project as it need to ensure no third party integration has already been created | ||
var ( | ||
|
@@ -848,6 +887,22 @@ func configWithPagerDuty(projectID, serviceKey string, enabled bool) string { | |
`, projectID, serviceKey, enabled) | ||
} | ||
|
||
func configWithEmail(projectID string, enabled bool) string { | ||
return fmt.Sprintf(` | ||
resource "mongodbatlas_alert_configuration" "test" { | ||
project_id = %[1]q | ||
enabled = %[2]t | ||
event_type = "NO_PRIMARY" | ||
|
||
notification { | ||
type_name = "EMAIL" | ||
interval_min = 60 | ||
email_address = "[email protected]" | ||
} | ||
} | ||
`, projectID, enabled) | ||
} | ||
|
||
func configWithPagerDutyIntegrationID(orgID, projectName, serviceKey string) string { | ||
return fmt.Sprintf(` | ||
resource "mongodbatlas_project" "test" { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative fix would be using requireReplace on changes to
type_name
that might handle more cases whereUseStateForUnknown
is not safeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there is the Update API available, I think it's better to follow standard update behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any chance this UseStateForUnknown was needed for something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the PR where it was introduced I see that it was only to reduce plan verbosity