Skip to content

Conversation

lantoli
Copy link
Collaborator

@lantoli lantoli commented Aug 14, 2025

Description

Convert from blocks to nested attributes in advancedClusterToV2 command

  • This converts only single replication specs and region configs, multi replication specs and multi region configs will be done in a follow-up PR
  • Other conversions such as with dynamic blocks will be done in follow-up PRs
  • Documentation will be updated in follow-up PRs

Link to any related issue(s): CLOUDP-337883

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 enhancement New feature or request label Aug 14, 2025
@lantoli lantoli marked this pull request as ready for review August 18, 2025 11:35
@Copilot Copilot AI review requested due to automatic review settings August 18, 2025 11:35
@lantoli lantoli requested a review from a team as a code owner August 18, 2025 11:35
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 implements conversion functionality for the advancedClusterToV2 command, transforming MongoDB Atlas advanced cluster configurations from blocks to nested attributes in Terraform configurations. This is part of migrating from SDKv2 schema to Terraform Plugin Framework (TPF) schema.

Key changes:

  • Implements core conversion logic in adv2v2.go to transform block syntax to nested attribute syntax
  • Adds comprehensive test data covering various scenarios including basic clusters, specs, tags/labels, and advanced configurations
  • Refactors shared constants from clu2adv.go to const.go for reuse

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/convert/adv2v2.go Core implementation of block-to-nested-attribute conversion logic
internal/convert/const.go Moved shared constants from clu2adv.go and added new ones for adv2v2 functionality
internal/convert/clu2adv.go Removed constants now in const.go and minor reordering of function calls
internal/cli/clu2adv/clu2adv.go Fixed struct field embedding syntax
test/e2e/testdata/adv2v2.* E2E test data showing input and expected output transformations
internal/convert/testdata/adv2v2/* Unit test data covering various conversion scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

if err != nil {
return nil, err
}
if updated {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe a comment here to explain what's handling?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added here: e5fa697

@lantoli lantoli merged commit 0900ebc into main Aug 19, 2025
9 checks passed
@lantoli lantoli deleted the CLOUDP-337883_blocks branch August 19, 2025 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants