Skip to content

Commit 2197323

Browse files
oarbusimaasthalantoliEspenAlbertjwilliams-mongo
authored
feat: Reaches GA for Flex Cluster and support for flex clusters in mongodbatlas_advanced_cluster (#3092)
* feat: Updates GA status for `mongodbatlas_flex_cluster` resource and data sources (#3003) * remove preview * changelog * remove env var for preview * chore: Adds cipher config & default_max_time_ms to advanced_cluster_tpf (#2972) * chore: Implements `tags` and `labels` as MapAttribute in `advanced_cluster` schema v2 (#2996) * schema change * model change * create TF models * create Admin models * labels & tags conversion * TEMPORARY skip mocked tests * handle null vs [] * Revert "TEMPORARY skip mocked tests" This reverts commit 3653edc. * temporary don't test check label and tags * improve update and override * fix plan changes in state upgrade * test checks for labels and tags * apply feedback * feat: Supports Flex Clusters in `mongodbatlas_advanced_cluster` resource and data sources (SDKv2) (#3001) * implement create flex cluster in advanced_cluster * implement read flex cluster in advanced_cluster * effective_cluster_type and logic for update * wip upgrade M0 to Flex to avoid warnings * implement delete of flex cluster in advanced_cluster and minor refacor of flex * data sources and tests * final fixes * changelog * dont' do 2 API calls when deleting * clean up * clarify update logic * pr comments refactors * refactor isFlex * move method into advancedcluster package from flex * set priority to 7 to avoid changes when/id flex changes to dedicated * separate better concerns when creating update or upgrade object * fix typos * test ConvertAdvancedClusterToSchemaV2 * non parallel test to avoid issues with plural data sources checks * refactor flex read in data source and resource * clean up * diags * use diags instead of return err * final * refactor the tpf_adapter to handle diags conversion and call advancedclustertpf package * docs review * changelog * use constants for errors * keep const and convert to var in check method * move IsFlex to advancedclustertpf * refactor import to reuse GetClusterDetails --------- Co-authored-by: Espen Albert <[email protected]> * deprecate: Deprecates Serverless and Shared-tier functionality (#3012) * deprecate shared and serverless resource and data sources * deprecation warning when using shared tier in cluster resource + small fix on var name * deprecation warning when using shared tier in advanced_cluster resource * changelog * Update docs/resources/serverless_instance.md Co-authored-by: John Williams <[email protected]> * Update docs/data-sources/serverless_instances.md Co-authored-by: John Williams <[email protected]> * Update docs/data-sources/serverless_instance.md Co-authored-by: John Williams <[email protected]> * Update docs/data-sources/cloud_provider_shared_tier_snapshots.md Co-authored-by: John Williams <[email protected]> * Update docs/data-sources/cloud_provider_shared_tier_restore_job.md Co-authored-by: John Williams <[email protected]> * Update docs/data-sources/cloud_provider_shared_tier_snapshot.md Co-authored-by: John Williams <[email protected]> * Update docs/data-sources/cloud_provider_shared_tier_restore_jobs.md Co-authored-by: John Williams <[email protected]> * use constant for January 2026 and fix typo --------- Co-authored-by: John Williams <[email protected]> * feat: Supports Flex Clusters in `mongodbatlas_advanced_cluster` resource (TPF) (#3020) * wip * wip: resource implemented * temp: remove data sources in flex test * minor fixes * override tags and labels * minor refactors * move to model_flex * avoid detected value change for new state in advanced_configuration * wip: final fixes * tags check in tests * update fix * remove import step in test * minor improvements * diags and refactors * pr comments * fix data source config for SDKv2 tests * pr comments * feat: Supports Flex Clusters in `mongodbatlas_advanced_cluster` data sources (TPF) (#3028) * singular data source * plural data source * add data sources in tests for tpf * mocked acceptance test changes * re capture * revert changes and skip mock tests * json whitespace * feat: Supports retrieval of Flex clusters snapshots using `mongodbatlas_flex_snapshot` data sources (#3036) * wip * model and plural data source * add data sources to provider * revert makefile commit * fixes * make * changelog * fix name of field * docs * docs fix * pr comments * pr comments * chore: Merges latest TPF changes and simplifies flex data sources (#3038) * doc: Adds outputs documentation to the cluster to advanced_cluster migration guide (#3029) * output doc * generic user folder * and * remove emails * add snapshot_backup_policy * apply feedback * change email * chore: Adds plan modifier to reduce plan verbosity for `advanced_cluster` tpf (#3002) * feat: Implement ModifyPlan method to handle unknown fields in advanced_cluster tpf * feat: Enhance ModifyPlan to handle unknown fields and improve replication specs processing * refactor: Move out plan_modifer internal functions * refactor: Simplify ModifyPlan by removing unused variables and logging * fix: region and root disk size missmatch * chore: minor fixes for the plan modifier * fix typo * refactor: Extract findClusterDiff logic to simplify update logic and allow usage from ModifyPlan * refactor: Enhance CopyUnknowns and useRemoteForUnknown to support keeping specific unknown fields * test: Regenerate the mock files to includ `id` in PATCH similar to SDKv2 implementation * populateIDValuesUsingNewAPI is no longer used * refactor: Update patch options to ignore 'id' when latest schema is used * refactor: Add MongoDBVersion to keepUnknown when updating MongoDBMajorVersion * refactor: Move MongoDBVersion check inside the update condition for safer handling during MongoDBMajorVersion updates * test: Update mock files to reflect no `id` in PATCH * refactor: Rename functions and parameters from explode --> expand [ci skip] * refactor: remove unnecessary remote read in PlanModifier * doc: Adds docstrings to answer PR comments * refactor: Simplify IsUnknown function by using panic and update name of remote-->state * refactor: planModifier re-use 1 * refactor: planModifier re-use 2 * remove unnecessary comment * refactor: move general methods to common/schemafunc * feat: enhance CopyUnknowns to support nested structures * feat: add validation for keepUnknown names and use tflog in KeepUnknown * refactor: simplify CopyUnknowns function by removing nestedStructMapping parameter and updating related logic * refactor: use the new UseStateForUnknown function * fix lint errors * fix: accidental update to config package * fieldalignment [ci skip] * fix: accidental address of pointer * fix: correct typo in backup_enabled field * address PR comments [ci skip] * address PR comments --------- Co-authored-by: Leo Antoli <[email protected]> * chore: Uses `ProjectIDExecutionWithCluster` in `cluster` tests (#3030) * simple changes * chore: Updates tests to use ProjectIDExecutionWithCluster where not plural data source is used * chore: Removes todo section from readme in tpf package (#3033) * chore: Removes todo section * deleting old readmes as suggested * clarify doc (#3032) * chore: Simplifies getBasicClusterModel to make it easier to call from data sources and flex (#3031) * refactor: initial work to use consistent useReplicationSpecPerShard * refactor: simplify getBasicClusterModel to avoid passing *TFModel (doesn't make sense in data sources and flex) * doc: Add comments * refactor: rename to ues usinggNewShardingConfig * refactor: rename variables for clarity in findClusterDiff function * refactor: correct variable name for clarity in CreateCluster function * fix build errors * refactor: Adds NewTFModelFlexResource to avoid passing TFModel in data sources * refactor: Remove unused parameter from getFlexClustersModels function * chore: enable test again and regenerate mock file --------- Co-authored-by: Leo Antoli <[email protected]> * feat: Supports retrieval of Flex clusters restore jobs using `mongodbatlas_flex_restore_job` data sources (#3041) * restore job data sources * add data source to provider * computed * changelog * docs * plural fix * fix example * consistent ProjectID * snapshotId to snapshotID * RestoreJobId to RestoreJobID * chore: Set default priority (7) for imported flex clusters in mongodbatlas_advanced_cluster (#3044) * chore: Merge branch 'master' into CLOUDP-282554-flex-ga (#3066) * doc: Document Flex cluster support in `mongodbatlas_advanced_cluster` resource and data sources (#3070) * docs changes for flex support * recommendation for flex * fix data sources docs * fix data sources pl * fix missing s * Update docs/resources/advanced_cluster.md Co-authored-by: Marco Suma <[email protected]> * Update docs/resources/advanced_cluster.md * Update docs/data-sources/advanced_cluster.md Co-authored-by: Agustin Bettati <[email protected]> * Update docs/resources/advanced_cluster.md Co-authored-by: John Williams <[email protected]> * Update docs/data-sources/flex_cluster.md Co-authored-by: John Williams <[email protected]> * Update docs/data-sources/flex_clusters.md Co-authored-by: John Williams <[email protected]> * Update docs/resources/advanced_cluster.md Co-authored-by: John Williams <[email protected]> * Update docs/resources/advanced_cluster.md Co-authored-by: John Williams <[email protected]> * Update docs/resources/flex_cluster.md Co-authored-by: John Williams <[email protected]> * Update templates/data-sources/flex_cluster.md.tmpl Co-authored-by: John Williams <[email protected]> * Update templates/data-sources/flex_clusters.md.tmpl Co-authored-by: John Williams <[email protected]> * Update templates/resources/flex_cluster.md.tmpl Co-authored-by: John Williams <[email protected]> * pr suggestion * align template --------- Co-authored-by: Marco Suma <[email protected]> Co-authored-by: Agustin Bettati <[email protected]> Co-authored-by: John Williams <[email protected]> * chore: Implements upgrade from M0 to Flex in `mongodbatlas_advanced_cluster` (#3061) * init * handle temp error during upgrade * tests * lint * tpf * lint * min * min * timeout * handle zonename * nit * minor * nit * address PR comments * Update internal/service/advancedclustertpf/model_flex.go Co-authored-by: Leo Antoli <[email protected]> * address PR comments * tmp * Revert "tmp" This reverts commit ccda546. * Revert "address PR comments" This reverts commit 9914e0a. * ut * Revert "ut" This reverts commit 7fb5628. * minor * mockable test * mocked test capture and clean up basicTenant * remove 3rd step * api req * mocked test fix * mocked test fix * nil check --------- Co-authored-by: Leo Antoli <[email protected]> Co-authored-by: Oriol Arbusi <[email protected]> * chore: Fixes inconsistent result errors (#3089) * refactor: Refactor out flex upgrade/update logic * chore: initial imlementation of flexUpgrade plan modifier * chore: Update ZoneName in NewReplicationSpecsFromFlexDescription to "Zone 1" * chore: Enhance unknown tenant upgrade handling in plan modifier for flex cluster * chore: Add comment to clarify handling of Unknown fields in flex cluster upgrade * chore: Rename flexChanges function to flexUpgradedUpdated for clarity * doc: Adds examples for flex clusters in `mongodbatlas_advanced_cluster` (#3088) * upgrade flex example * readme formatting * Update examples/mongodbatlas_advanced_cluster/flex-upgrade/README.md Co-authored-by: Marco Suma <[email protected]> * org * clarify readme of example * add node_count as var --------- Co-authored-by: Marco Suma <[email protected]> * chore: Implements upgrade from Flex to Dedicated in `mongodbatlas_advanced_cluster` (#3091) * sdkv2 flex upgrade to dedicated * refactor: Refactor out flex upgrade/update logic * chore: initial imlementation of flexUpgrade plan modifier * chore: Update ZoneName in NewReplicationSpecsFromFlexDescription to "Zone 1" * chore: Enhance unknown tenant upgrade handling in plan modifier for flex cluster * upgrade from flex to dedicated in SDKv2 * clean up duplicated code * tpf implementation * plan modifier and clean up * tenant fix * revert defaultPriority export * restore commnent * mocked test * rename config * rename test * pr comments --------- Co-authored-by: Espen Albert <[email protected]> * m2 m5 mentions removed * run M0 test non paralelly * doc: Recommends `mongodbatlas_advanced_cluster` in the migration guides and mention data sources for shared-tier migration (#3093) * recommend adv_cluster and mention data sources for shared tier * simplify shared to flex * fix * Update docs/guides/serverless-shared-migration-guide.md Co-authored-by: Jeff Vincent <[email protected]> * pr comments * Update docs/guides/serverless-shared-migration-guide.md Co-authored-by: Jeff Vincent <[email protected]> * Update docs/guides/serverless-shared-migration-guide.md Co-authored-by: Jeff Vincent <[email protected]> --------- Co-authored-by: Jeff Vincent <[email protected]> --------- Co-authored-by: maastha <[email protected]> Co-authored-by: Leo Antoli <[email protected]> Co-authored-by: Espen Albert <[email protected]> Co-authored-by: John Williams <[email protected]> Co-authored-by: Espen Albert <[email protected]> Co-authored-by: Marco Suma <[email protected]> Co-authored-by: Agustin Bettati <[email protected]> Co-authored-by: Jeff Vincent <[email protected]>
1 parent d118b0c commit 2197323

File tree

107 files changed

+3674
-778
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+3674
-778
lines changed

.changelog/3001.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
```release-note:enhancement
2+
resource/mongodbatlas_advanced_cluster: This resource can now create, read, update, and delete Flex clusters
3+
```
4+
5+
```release-note:enhancement
6+
data-source/mongodbatlas_advanced_cluster: This data source can now read Flex clusters
7+
```
8+
9+
```release-note:enhancement
10+
data-source/mongodbatlas_advanced_clusters: This data source can now read Flex clusters
11+
```

.changelog/3003.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
```release-note:enhancement
2+
resource/mongodbatlas_flex_cluster: Reaches GA (General Availability)
3+
```
4+
5+
```release-note:enhancement
6+
data-source/mongodbatlas_flex_cluster: Reaches GA (General Availability)
7+
```
8+
9+
```release-note:enhancement
10+
data-source/mongodbatlas_flex_cluster: Reaches GA (General Availability)
11+
```

.changelog/3012.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
```release-note:note
2+
resource/mongodbatlas_serverless_instance: Deprecates resource
3+
```
4+
5+
```release-note:note
6+
data-source/mongodbatlas_serverless_instance: Deprecates data source
7+
```
8+
9+
```release-note:note
10+
data-source/mongodbatlas_serverless_instances: Deprecates data source
11+
```
12+
13+
```release-note:note
14+
data-source/mongodbatlas_shared_tier_restore_job: Deprecates data source
15+
```
16+
17+
```release-note:note
18+
data-source/mongodbatlas_shared_tier_restore_jobs: Deprecates data source
19+
```
20+
21+
```release-note:note
22+
data-source/mongodbatlas_shared_tier_snapshot: Deprecates data source
23+
```
24+
25+
```release-note:note
26+
data-source/mongodbatlas_shared_tier_snapshot: Deprecates data source
27+
```
28+
29+
```release-note:note
30+
resource/mongodbatlas_cluster: Deprecates `M2` and `M5` instance size values for the attribute `provider_instance_size_name`
31+
```
32+
33+
```release-note:note
34+
resource/mongodbatlas_advanced_cluster: Deprecates `M2` and `M5` instance size for the attribute `instance_size` inside of `analytics_specs`, `electable_specs` and `read_only_specs`
35+
```

.changelog/3036.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```release-note:new-datasource
2+
mongodbatlas_flex_snapshot
3+
```
4+
5+
```release-note:new-datasource
6+
mongodbatlas_flex_snapshots
7+
```

.changelog/3041.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```release-note:new-datasource
2+
mongodbatlas_flex_restore_job
3+
```
4+
5+
```release-note:new-datasource
6+
mongodbatlas_flex_restore_jobs
7+
```

.github/workflows/acceptance-tests-runner.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,6 @@ jobs:
746746
env:
747747
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
748748
MONGODB_ATLAS_FLEX_PROJECT_ID: ${{ inputs.mongodb_atlas_flex_project_id }}
749-
MONGODB_ATLAS_ENABLE_PREVIEW: "true"
750749
ACCTEST_PACKAGES: ./internal/service/flexcluster
751750
run: make testacc
752751

docs/data-sources/advanced_cluster.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<br> &#8226; Changes to cluster configurations can affect costs. Before making changes, please see [Billing](https://docs.atlas.mongodb.com/billing/).
99
<br> &#8226; If your Atlas project contains a custom role that uses actions introduced in a specific MongoDB version, you cannot create a cluster with a MongoDB version less than that version unless you delete the custom role.
1010

11+
-> **NOTE:** This data source also includes Flex clusters.
12+
1113
## Example Usage
1214

1315
```terraform
@@ -80,6 +82,30 @@ data "mongodbatlas_advanced_cluster" "example" {
8082
}
8183
```
8284

85+
## Example using Flex cluster
86+
87+
```terraform
88+
resource "mongodbatlas_advanced_cluster" "example-flex" {
89+
project_id = "<YOUR-PROJECT-ID>"
90+
name = "flex-cluster"
91+
cluster_type = "REPLICASET"
92+
93+
replication_specs {
94+
region_configs {
95+
provider_name = "FLEX"
96+
backing_provider_name = "AWS"
97+
region_name = "US_EAST_1"
98+
priority = 7
99+
}
100+
}
101+
}
102+
103+
data "mongodbatlas_advanced_cluster" "example" {
104+
project_id = mongodbatlas_advanced_cluster.example-flex.project_id
105+
name = mongodbatlas_advanced_cluster.example-flex.name
106+
}
107+
```
108+
83109
## Argument Reference
84110

85111
* `project_id` - (Required) The unique ID for the project to create the database user.

docs/data-sources/advanced_clusters.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<br> &#8226; Changes to cluster configurations can affect costs. Before making changes, please see [Billing](https://docs.atlas.mongodb.com/billing/).
99
<br> &#8226; If your Atlas project contains a custom role that uses actions introduced in a specific MongoDB version, you cannot create a cluster with a MongoDB version less than that version unless you delete the custom role.
1010

11+
-> **NOTE:** This data source also includes Flex clusters.
12+
1113
## Example Usage
1214

1315
```terraform
@@ -79,6 +81,29 @@ data "mongodbatlas_advanced_cluster" "example-asym" {
7981
}
8082
```
8183

84+
## Example using Flex cluster
85+
86+
```terraform
87+
resource "mongodbatlas_advanced_cluster" "example-flex" {
88+
project_id = "<YOUR-PROJECT-ID>"
89+
name = "flex-cluster"
90+
cluster_type = "REPLICASET"
91+
92+
replication_specs {
93+
region_configs {
94+
provider_name = "FLEX"
95+
backing_provider_name = "AWS"
96+
region_name = "US_EAST_1"
97+
priority = 7
98+
}
99+
}
100+
}
101+
102+
data "mongodbatlas_advanced_clusters" "example" {
103+
project_id = mongodbatlas_advanced_cluster.example-flex.project_id
104+
}
105+
```
106+
82107
## Argument Reference
83108

84109
* `project_id` - (Required) The unique ID for the project to get the clusters.

docs/data-sources/cloud_provider_shared_tier_restore_job.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
---
2+
subcategory: "Deprecated"
3+
---
4+
5+
**WARNING:** This data source is deprecated and will be removed in January 2026. For more details, see [Migration Guide: Transition out of Serverless Instances and Shared-tier clusters](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/serverless-shared-migration-guide).
6+
17
# Data Source: mongodbatlas_shared_tier_restore_job
28

39
`mongodbatlas_shared_tier_restore_job` provides a Cloud Backup Snapshot Restore Job data source for Shared Tier Clusters. Gets the cloud backup snapshot restore jobs for the specified shared tier cluster.

docs/data-sources/cloud_provider_shared_tier_restore_jobs.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
---
2+
subcategory: "Deprecated"
3+
---
4+
5+
**WARNING:** This data source is deprecated and will be removed in January 2026. For more details, see [Migration Guide: Transition out of Serverless Instances and Shared-tier clusters](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/serverless-shared-migration-guide).
6+
17
# Data Source: mongodbatlas_shared_tier_restore_jobs
28

39
`mongodbatlas_shared_tier_restore_jobs` provides Cloud Backup Snapshot Restore Jobs data source for Shared Tier Clusters. Gets all the cloud backup snapshot restore jobs for the specified shared tier cluster.

0 commit comments

Comments
 (0)