Skip to content

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 3 commits into from
Feb 12, 2025

Conversation

oarbusi
Copy link
Collaborator

@oarbusi oarbusi commented Feb 11, 2025

Description

avoids error when updating from an email notification to a 'PAGER_DUTY', 'OPS_GENIE' or 'VICTOR_OPS' that require interval_min attribute to not be set

mongodbatlas_alert_configuration.no_primary[0]: Modifying... [id=aWQ=:NjdhYjIwYWVmMTRjZDc2MmNiYjliNDZh-cHJvamVjdF9pZA==:NjZkNmQyYmRiMTgxZjg2NjUyMjI1MDli]
╷
│ Error: error updating Alert Configuration information: %s
│ 
│   with mongodbatlas_alert_configuration.no_primary[0],
│   on main.tf line 131, in resource "mongodbatlas_alert_configuration" "no_primary":
│  131: resource "mongodbatlas_alert_configuration" "no_primary" {
│ 
│ 'interval_min' must not be set if type_name is 'PAGER_DUTY', 'OPS_GENIE' or 'VICTOR_OPS'
╵

Link to any related issue(s): HELP-70810

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR. A migration guide must be created or updated if the new feature will go in a major version.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR. A migration guide must be created or updated.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contributing guides
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals I have added appropriate changelog entries.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

@github-actions github-actions bot added the bug label Feb 11, 2025
@oarbusi oarbusi marked this pull request as ready for review February 11, 2025 11:15
@oarbusi oarbusi requested review from a team as code owners February 11, 2025 11:15
Copy link
Contributor

APIx bot: a message has been sent to Docs Slack channel

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

func TestAccConfigRSAlertConfiguration_withEmailToPagerDuty(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test case!

@@ -283,9 +283,6 @@ func (r *alertConfigurationRS) Schema(ctx context.Context, req resource.SchemaRe
"interval_min": schema.Int64Attribute{
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Int64{
Copy link
Collaborator

@EspenAlbert EspenAlbert Feb 11, 2025

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 where UseStateForUnknown is not safe

Copy link
Collaborator Author

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

Copy link
Collaborator

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?

Copy link
Collaborator Author

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

Copy link
Contributor

@carriecwk carriecwk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@oarbusi oarbusi merged commit 869905b into master Feb 12, 2025
40 checks passed
@oarbusi oarbusi deleted the HELP-70810 branch February 12, 2025 08:27
svc-apix-Bot added a commit that referenced this pull request Feb 12, 2025
lantoli added a commit that referenced this pull request Feb 12, 2025
* master:
  doc: Renames env var to `MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER` (#3062)
  chore: Updates Atlas Go SDK (#3053)
  test: Tenant clusters with disk_size_gb is always 5 now (#3057)
  chore: Updates CHANGELOG.md for #3051
  fix: Removes `interval_min` plan modifier to avoid error on update (#3051)
  build(deps): bump go.mongodb.org/atlas-sdk (#3049)
  doc: Adds pinned_fcv.version as exported attribute in cluster and advanced cluster resource (#3047)
  update Go to 1.23.6 (#3045)
  chore: Adds HTTP status check helper methods (#3035)
  chore: Adds import checks to tests (#3039)
  chore: Updates CHANGELOG.md header for v1.26.1 release
  chore: Updates examples link in index.md for v1.26.1 release
  fix: Adds "state_name" to keepUnknown list to prevent copying volatile attributes from state (#3040)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants