Skip to content

Conversation

@maastha
Copy link
Collaborator

@maastha maastha commented Aug 2, 2025

Description

This PR:

  • disables use of MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER env variable (maybe still required to run some migration tests against versions 2.0.0)
  • removed advanced_cluster SDKv2 example
  • updates GetClusterInfo to return TPF cluster configttps://jira.mongodb.org/browse/CLOUDP-336435) (refer remove: Removes cloud_backup_schedule deprecated params #3560 for some of the test runs)
  • updated currently used *PreviewProviderV2* method/files names to be *MigTPF* instead

Follow-up PR #3551 updates relevant migration tests to TPF configs

Other PRs to follow-up:

  • Update all advanced_cluster acceptance tests to use only TPF configs & checks
  • Update all examples, documentation & guides to refer only TPF configs & remove references to MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER. Upgrade guide 2.0 will also be updated.
  • Move migration & acceptance test files to tpf package

Link to any related issue(s): CLOUDP-334497
https://jira.mongodb.org/browse/CLOUDP-336435

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

@maastha maastha changed the title chore: Cloudp 334497 disable adv cluster sd kv2 b chore: Disables use of MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER Aug 5, 2025
@maastha maastha changed the title chore: Disables use of MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER feat: Disables use of MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER Aug 5, 2025
@maastha maastha changed the title feat: Disables use of MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER remove: Disables use of MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER Aug 5, 2025
// TODO: delete this file once all tests are migrated to using TPF configurations
func PreviewProviderV2AdvancedCluster() bool {
return previewProviderV2AdvancedCluster
return true
Copy link
Collaborator Author

@maastha maastha Aug 6, 2025

Choose a reason for hiding this comment

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

temporarily defaulting to true until all tests/code has been updated (CLOUDP-336437)

terraform_wrapper: false
- name: tf-validate
run: make tools tf-validate
# TODO: uncomment once advanced_cluster examples are updated
Copy link
Collaborator Author

@maastha maastha Aug 6, 2025

Choose a reason for hiding this comment

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

all pending items in this PR will be addressed in CLOUDP-336437

@maastha maastha marked this pull request as ready for review August 6, 2025 11:24
Copilot AI review requested due to automatic review settings August 6, 2025 11:24
@maastha maastha requested review from a team as code owners August 6, 2025 11:24
@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2025

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

Copy link
Contributor

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 disables the legacy SDKv2 implementation of mongodbatlas_advanced_cluster resources and removes the MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER feature flag, transitioning fully to the Terraform Plugin Framework (TPF) implementation.

Key changes:

  • Removes environment variable checks and always returns true for TPF usage
  • Eliminates SDKv2 resource registration from provider maps
  • Deletes multiple SDKv2 advanced_cluster example configurations
  • Updates test utilities to use TPF configuration format exclusively

Reviewed Changes

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

Show a summary per file
File Description
internal/config/preview_provider_v2.go Hardcodes TPF usage by always returning true
internal/provider/*.go Removes conditional SDKv2 resource registration
internal/testutil/acc/*.go Updates cluster configuration generation for TPF format
examples/mongodbatlas_advanced_cluster/* Removes entire SDKv2 example directories
scripts/tf-validate.sh Removes V2 schema detection logic
Makefile & .github/workflows/* Removes environment variable usage in CI

@@ -1,62 +0,0 @@
# MongoDB Atlas Provider -- Global Cluster
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see from the PR desc:

Update all examples, documentation & guides to refer only TPF configs & remove references to MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER

However, do we want to delete these before? I assume it might be to have all required checks pass?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

don't have a strong opinion, but I think I'd leverage working in the dev branch & tackling tricky time consuming areas first. Updating examples would be easy to do later so I don't want to prioritize that right now

Copy link
Collaborator

@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.

Great!

func writeReplicationSpec(cluster *hclwrite.Body, spec admin.ReplicationSpec20240805) error {
replicationBlock := cluster.AppendNewBlock("replication_specs", nil).Body()
err := addPrimitiveAttributesViaJSON(replicationBlock, spec)
func recursiveJSONToCty(raw any) (cty.Value, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

these methods were earlier creating SDKv2 configuration for a cluster, now updated to generate TPF config instead

Copy link
Collaborator

Choose a reason for hiding this comment

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

can you share a bit more details about recursiveJSONToCty ? was it in some other part of our code base or brand new? It just feels like a very generic util method (and I don't understand why it's needed now)

Copy link
Collaborator Author

@maastha maastha Aug 7, 2025

Choose a reason for hiding this comment

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

that was added to handle translation for nested objects to TF config. I've simplified the implementation now & combined this with existing handling of primitive attributes in setAttributes


import (
"testing"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why these changes? Maybe move to the plugin repo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

these methods generate SDKv2 based advanced_cluster configurations for acceptance tests from a Go object. This has now been updated to instead generate TPF configuration for advanced_cluster.
I don't see a plugin repo relevance here

Copy link
Collaborator

@jwilliams-mongo jwilliams-mongo left a comment

Choose a reason for hiding this comment

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

lgtm % a few tiny tweaks to changelog entries

func writeReplicationSpec(cluster *hclwrite.Body, spec admin.ReplicationSpec20240805) error {
replicationBlock := cluster.AppendNewBlock("replication_specs", nil).Body()
err := addPrimitiveAttributesViaJSON(replicationBlock, spec)
func recursiveJSONToCty(raw any) (cty.Value, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you share a bit more details about recursiveJSONToCty ? was it in some other part of our code base or brand new? It just feels like a very generic util method (and I don't understand why it's needed now)

@marcosuma marcosuma self-requested a review August 6, 2025 15:36
@maastha maastha merged commit d39b3c1 into CLOUDP-320243-dev-2.0.0 Aug 11, 2025
39 of 42 checks passed
@maastha maastha deleted the CLOUDP-334497-disable_adv_clusterSDKv2-b branch August 11, 2025 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants