-
Notifications
You must be signed in to change notification settings - Fork 210
remove: Disables use of MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER
#3547
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
remove: Disables use of MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER
#3547
Conversation
MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER
MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTERMONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER
MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTERMONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER
| // TODO: delete this file once all tests are migrated to using TPF configurations | ||
| func PreviewProviderV2AdvancedCluster() bool { | ||
| return previewProviderV2AdvancedCluster | ||
| return 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.
temporarily defaulting to true until all tests/code has been updated (CLOUDP-336437)
.github/workflows/examples.yml
Outdated
| terraform_wrapper: false | ||
| - name: tf-validate | ||
| run: make tools tf-validate | ||
| # TODO: uncomment once advanced_cluster examples are updated |
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.
all pending items in this PR will be addressed in CLOUDP-336437
|
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 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 | |||
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 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?
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.
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
EspenAlbert
left a comment
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.
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) { |
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.
why this change?
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.
these methods were earlier creating SDKv2 configuration for a cluster, now updated to generate TPF config instead
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.
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)
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.
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" | ||
|
|
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.
Why these changes? Maybe move to the plugin repo?
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.
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
jwilliams-mongo
left a comment
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 % 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) { |
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.
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)
Description
This PR:
MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTERenv variable (maybe still required to run some migration tests against versions 2.0.0)cloud_backup_scheduledeprecated params #3560 for some of the test runs)*PreviewProviderV2*method/files names to be*MigTPF*insteadFollow-up PR #3551 updates relevant migration tests to TPF configs
Other PRs to follow-up:
Link to any related issue(s): CLOUDP-334497
https://jira.mongodb.org/browse/CLOUDP-336435
Type of change:
Required Checklist:
Further comments