-
Notifications
You must be signed in to change notification settings - Fork 206
refactor: Uses createOnlyWithDefault for delete_on_create_timeout in flexcluster #3625
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: CLOUDP-320243-dev-2.0.0
Are you sure you want to change the base?
Conversation
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! |
…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) { |
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.
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 { |
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.
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), |
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.
Updated
APIx bot: a message has been sent to Docs Slack channel |
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 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 fordelete_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.
internal/service/cloudprovideraccess/resource_cloud_provider_access_setup.go
Show resolved
Hide resolved
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, just a minor change 👍🏽
…icTestCase, it is kept as is (UseStateForUnknown)
@@ -4,7 +4,7 @@ subcategory: "Cloud Provider Access" | |||
|
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 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
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.
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
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.
I can also recommend checking the changes to create_only.go
to compare the plan modifiers
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.
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]>
failing tests are currently flaky in master: TestAccProject_withTags |
TODO: Will rebase this with dev branch now that the plan modifier logic exists there |
Description
Link to any related issue(s): CLOUDP-302586 and #3525
Type of change:
Required Checklist:
Further comments