-
Notifications
You must be signed in to change notification settings - Fork 205
test: Ensures project withDefaultAlertsSettings
works with import and introduce create_only plan modifier
#3105
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
base: master
Are you sure you want to change the base?
Conversation
APIx bot: a message has been sent to Docs Slack channel |
…ore in project tests when it is not set to `false` in earlier steps
@EspenAlbert nit: can we have a why in the summary section to explain the change? also let's hold this merge until we have a conversation with the upstream team (if we did, we should connect the CLOUDPs and understand the why on their side) |
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.
LGTM
…ibute handling to support multiple planmodifiers
…ibutePlanModifier in resource schemas
Will get back to this on Wednesday |
planmodifier.Bool | ||
} | ||
|
||
func CreateOnlyAttributePlanModifier() Modifier { |
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.
Can we add a comment on what this plan modifier does & why it's needed?
This PR has gone 7 days without any activity and meets the project’s definition of "stale". This will be auto-closed if there is no new activity over the next 7 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy! |
…or_with_default_alert_settings
…support and refactor IsKnown utility function
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.
@EspenAlbert let's hold on this one. I am not too convinced we are doing the right thing in adding more complexity to handle something like this. Let's chat in today's tech sync.
withDefaultAlertsSettings
works with import and introduce create_only plan modifier
…or_with_default_alert_settings
…y default behavior
…ngs migration test cases
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.
Pull Request Overview
This PR introduces a create-only plan modifier for the with_default_alerts_settings
attribute in MongoDB Atlas projects to align with API changes that now return this value after creation. The change prevents users from updating this attribute after project creation while maintaining backward compatibility.
- Implements create-only behavior for
with_default_alerts_settings
attribute with proper error messaging - Updates test infrastructure to validate import functionality and plan behavior
- Refactors plan modifiers from generic "non-updatable" to specific "create-only" pattern
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
internal/service/project/resource_project_schema.go |
Replaces default value with create-only plan modifier for with_default_alerts_settings |
internal/service/project/resource_project_test.go |
Enhances tests to validate create-only behavior and import scenarios |
internal/service/project/resource_project_migration_test.go |
Updates migration tests to use parameterized alert settings configurations |
internal/common/customplanmodifier/create_only.go |
Implements new create-only plan modifier with default value support |
internal/common/customplanmodifier/non_updatable.go |
Removes old non-updatable plan modifier |
internal/testutil/acc/project.go |
Removes with_default_alerts_settings from test configuration helper |
internal/service/flexcluster/resource_schema.go |
Updates to use new create-only plan modifier |
docs/resources/project.md |
Updates documentation to clarify create-only nature of the attribute |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Description
Link to any related issue(s): CLOUDP-302586 & #3103
Updated context:
with_default_alert_settings
, before this was only set on create and never returned.During Plan
true
should match what the API returns, covered by:TestMigProject_basic
TestMigProject_withTrueDefaultAlertSettings
false
value, covered by:TestMigProject_withFalseDefaultAlertSettings
terraform plan
, see the error message below.The user will be forced to update their config to match the API value, otherwise they will get inconsistent result value.
During Update
Before this change, Terraform allowed updates to
with_default_alert_settings
, but now we will raise an error:Error message:
Example when the user has modified the attribute value after creation (created with
with_default_alerts_settings= true
)During Import
Import works now due to the API change, and the experience will be the same as described in
During Plan
aboveType of change:
Required Checklist:
Further comments