Skip to content

Conversation

EspenAlbert
Copy link
Collaborator

@EspenAlbert EspenAlbert commented Aug 27, 2025

Description

  • Uses createOnlyWithDefault for delete_on_create_timeout in flexcluster
  • NOTE: Had to merge with master to resolve the conflicts for create_only.go and get the new version used in project.with_default_alert_settings

Link to any related issue(s): CLOUDP-302586 and #3525

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

Copy link
Contributor

github-actions bot commented Sep 2, 2025

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!

@github-actions github-actions bot added the stale label Sep 2, 2025
@EspenAlbert EspenAlbert added the not_stale Not stale issue or PR label Sep 2, 2025
oarbusi and others added 12 commits September 3, 2025 09:39
…godbatlas_encryption_at_rest` resource and data source (#3636)

* implement role_id

* docs and changelog

* fix unit test

* refactor checks

* fix inconsistent result after apply null/empty string

* docs notice

* pr suggestion missing period
…ion` resource (#3639)

* gcp for authorization resource

* cloud provider

* gcp is computed

* remove max items

* set gcp

* remove gcp from if in update

* add missing azure attribute in docs

* explain gcp update
…s on `mongodbatlas_cloud_provider_access_setup` resource and data source (#3637)

* Add GCP cloud provider access to mongodbatlas_cloud_provider_access_setup

* Fix typo for function name

* Add GCP configuration for schema on data source

* Change optional field to computed as required per provider

* Refactor function to accomodate for Cloud Provider Access - GCP

* Add documentation for resource

* Add GCP Cloud provider documentation for data source

* Add GCP provider for data source validation

* Add resource and resouce acceptance test for GCP Cloud Provider Access setup

* Fix format

* Add changelog

* Fix issue where role ID was missing for Azure config

* Fix format

* Fix issues for refactor on GCP

* Address PR comments

* Address further PR comments

* Refactor setup function to handle different cloud providers, and return error if provider used is not correct

Add error handling for cloud provider access

* Refactor multiple if/else statements into switch in order to avoid lint errors

* Address nit comments

* Substitute cloud provider string names with constants
…3620)

Bumps [amannn/action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request) from 6.1.0 to 6.1.1.
- [Release notes](https://github.com/amannn/action-semantic-pull-request/releases)
- [Changelog](https://github.com/amannn/action-semantic-pull-request/blob/main/CHANGELOG.md)
- [Commits](amannn/action-semantic-pull-request@7f33ba7...48f2562)

---
updated-dependencies:
- dependency-name: amannn/action-semantic-pull-request
  dependency-version: 6.1.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/pb33f/libopenapi](https://github.com/pb33f/libopenapi) from 0.25.3 to 0.25.6.
- [Release notes](https://github.com/pb33f/libopenapi/releases)
- [Commits](pb33f/libopenapi@v0.25.3...v0.25.6)

---
updated-dependencies:
- dependency-name: github.com/pb33f/libopenapi
  dependency-version: 0.25.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…nd introduce create_only plan modifier (#3105)

* fix: Sets default value for WithDefaultAlertsSettings during state import

* chore: Adds release note

* fix: Removes 'with_default_alerts_settings' from ImportStateVerifyIgnore in project tests when it is not set to `false` in earlier steps

* doc: update changelog message

* doc: Add back reference based on comments

* revert changes of old implementation

* refactor: Introduce Modifier interface and enhance non-updatable attribute handling to support multiple planmodifiers

* refactor: Mark with_default_alerts_settings as NonUpdateable

* refactor:Rename NonUpdatableAttributePlanModifier with CreateOnlyAttributePlanModifier in resource schemas

* feat: Implement CreateOnlyAttributePlanModifier with default boolean support and refactor IsKnown utility function

* chore: small fix to planModifier using state value when Unknown in the plan

* test: Support testing plan error after importing

* doc: Update error message in addDiags to clarify import restrictions

* chore: revert old changes for advancedclustertpf

* test: remove migration test util in favor of acc test step for empty plan check

* revert old changes

* doc: Updates docs with latest API docs

* refactor: remove the withDefaultAlertSettings override for plan

* refactor: Add create only attribute plan modifier for project_owner_id

* chore: update related docs

* refactor: Update error message to match original message

* docs: Update description for 'with_default_alerts_settings' to clarify default behavior

* refactor: Improve test function names and enhance default alert settings migration test cases

* test: Update alert settings handling in TestAccProject_withFalseDefaultSettings

* refactor: Rename Modifier interface to CreateOnlyModifier for clarity

* docs: Add comments to clarify CreateOnlyAttributePlanModifierWithBoolDefault behavior
// validateCreateOnly checks if an attribute value has changed and adds an error if it has
func validateCreateOnly(planValue, stateValue attr.Value, attrPath path.Path, diagnostics *diag.Diagnostics,
) {
if !stateValue.IsNull() && !stateValue.Equal(planValue) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The !stateValue.IsNull() is why "meaningless" update after import doesn't trigger an error.

// CreateOnlyStringPlanModifier creates a plan modifier that prevents updates to string attributes.
func CreateOnlyStringPlanModifier() planmodifier.String {
return &createOnlyAttributePlanModifier{}
type CreateOnlyModifier interface {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Choosing to keep only a single plan modifier implementation for createOnly instead of create create_only_with_default

PlanModifiers: []planmodifier.Bool{
customplanmodifier.CreateOnlyBoolPlanModifier(),
customplanmodifier.CreateOnlyAttributePlanModifierWithBoolDefault(true),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated

@EspenAlbert EspenAlbert marked this pull request as ready for review September 3, 2025 14:03
@Copilot Copilot AI review requested due to automatic review settings September 3, 2025 14:03
@EspenAlbert EspenAlbert requested review from a team as code owners September 3, 2025 14:03
Copy link
Contributor

github-actions bot commented Sep 3, 2025

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

Copy link
Contributor

@Copilot Copilot AI left a 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 refactors the delete_on_create_timeout attribute in flexcluster to use createOnlyWithDefault for better plan modifier consistency. It also includes related improvements to GCP authentication support for encryption at rest and cloud provider access, along with project configuration updates.

  • Updates flexcluster to use new CreateOnlyAttributePlanModifierWithBoolDefault plan modifier for delete_on_create_timeout
  • Adds GCP support for cloud provider access setup and authorization resources
  • Enhances encryption at rest configuration to support GCP role-based authentication

Reviewed Changes

Copilot reviewed 38 out of 39 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/service/flexcluster/resource_schema.go Updates delete_on_create_timeout to use new plan modifier with default value
internal/service/flexcluster/resource.go Simplifies timeout handling by using boolean value directly
internal/common/customplanmodifier/create_only.go Adds new plan modifier with default value support
internal/service/project/resource_project_schema.go Updates project schema to use new plan modifier pattern
internal/service/encryptionatrest/resource.go Adds role_id field support for GCP authentication
internal/service/cloudprovideraccess/resource_cloud_provider_access_setup.go Adds GCP provider support

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

@QuiqueSanMongo QuiqueSanMongo left a comment

Choose a reason for hiding this comment

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

LGTM, just a minor change 👍🏽

…icTestCase, it is kept as is (UseStateForUnknown)
@@ -4,7 +4,7 @@ subcategory: "Cloud Provider Access"

Copy link
Member

Choose a reason for hiding this comment

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

@EspenAlbert could we first trigger https://github.com/mongodb/terraform-provider-mongodbatlas/actions/workflows/update-dev-branches.yml so that all the changes you need from master are already present in the dev branch? Or alternatively provide the isolated commits for the changes associated to flex cluster

Copy link
Collaborator Author

@EspenAlbert EspenAlbert Sep 4, 2025

Choose a reason for hiding this comment

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

Yeah, it got a bit messy since I needed to merge with master.
Running the update manually will create a merge conflict that would require updates in other files... So it is a bit complicated :/
Changes to flex cluster is in this commit: 978dd91

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can also recommend checking the changes to create_only.go to compare the plan modifiers

Copy link
Collaborator

Choose a reason for hiding this comment

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

my concern with this is that if for whatever reason we need to revert the createOnlyWithDefault, we would also revert some unrelated pieces of code. What is the complication in merging master in 2.0.0 in the automated PR and open a new PR on top of that in 2.0.0 with your create_only changes?

Co-authored-by: Enrique Sánchez <[email protected]>
@EspenAlbert
Copy link
Collaborator Author

failing tests are currently flaky in master:

TestAccProject_withTags
TestAccStreamRSStreamConnection_kafkaNetworkingVPC

@lantoli lantoli removed the stale label Sep 5, 2025
@EspenAlbert EspenAlbert marked this pull request as draft September 5, 2025 12:20
@EspenAlbert
Copy link
Collaborator Author

TODO: Will rebase this with dev branch now that the plan modifier logic exists there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not_stale Not stale issue or PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants