Skip to content

Conversation

lantoli
Copy link
Collaborator

@lantoli lantoli commented Aug 19, 2025

Description

Convert multi replication specs multi regions advanced clusters

  • 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-339184

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 19, 2025
@lantoli lantoli changed the title feat: Convert multi replications specs multi regions advanced clusters feat: Convert multi replication specs multi regions advanced clusters Aug 19, 2025
@lantoli lantoli marked this pull request as ready for review August 19, 2025 10:35
@Copilot Copilot AI review requested due to automatic review settings August 19, 2025 10:35
@lantoli lantoli requested a review from a team as a code owner August 19, 2025 10: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 converts Terraform configuration blocks from replication_specs and region_configs blocks to array syntax for MongoDB Atlas advanced clusters. The conversion transforms block-style syntax to list-style syntax and adds validation to ensure required structures are present.

Key changes:

  • Converts nested replication_specs blocks to array format
  • Converts nested region_configs blocks to array format
  • Adds validation for missing replication specs and region configs

Reviewed Changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated 2 comments.

File Description
internal/convert/adv2v2.go Core conversion logic with validation for required specs and configs
internal/convert/testdata/adv2v2/*.in.tf Input test files showing original block syntax
internal/convert/testdata/adv2v2/*.out.tf Expected output files showing converted array syntax
internal/convert/testdata/adv2v2/errors.json Error message definitions for validation failures

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.

@@ -0,0 +1,6 @@
resource "mongodbatlas_advanced_cluster" "no_replication_specs" {
Copy link
Contributor

Choose a reason for hiding this comment

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

in all the examples I noticed we don't use num_shards: am I right? I am guessing that's on purpose because you don't still support it but you will?

Copy link
Contributor

Choose a reason for hiding this comment

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

same question applies to the .in.tf examples where there's usage of deprecated fields, such as root disk_size_gb

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

correct, the next PR is precisely about removing num_shards and disk_size_gb.

i prefer to do smaller more focused PRs

Copy link
Contributor

@EspenAlbert EspenAlbert left a comment

Choose a reason for hiding this comment

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

Nice! Love that is so little actual logic change! 👏

@lantoli lantoli merged commit b37f419 into main Aug 19, 2025
9 checks passed
@lantoli lantoli deleted the CLOUDP-339184_multi branch August 19, 2025 11:46
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.

3 participants