You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/mongodbatlas_advanced_cluster/effective_fields/README.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,16 +15,22 @@ effective_fields/
15
15
16
16
-**Migrating an existing module?** Review both [module_existing](./module_existing/) and [module_effective_fields](./module_effective_fields/) to understand the changes.
17
17
-**Creating a new module?** Go directly to [module_effective_fields](./module_effective_fields/).
18
-
-**How to use these modules?** See [module_user](./module_user/) - shows that migration only requires changing the module source.
18
+
-**How to use these modules?** See [module_user](./module_user/). It shows that migration requires only that you change the module source.
19
19
20
20
## What is use_effective_fields?
21
21
22
22
When auto-scaling is enabled, Atlas automatically adjusts instance sizes and disk capacity. This creates [configuration drift](https://developer.hashicorp.com/terraform/tutorials/state/resource-drift) that requires management.
23
23
24
-
**Future direction:** In provider v3.x, `use_effective_fields = true` will become the default behavior and the flag will be removed. Migrating now is recommended to prepare for this transition.
24
+
`use_effective_fields` is an attribute for the `mongodbatlas_advanced_cluster` resource and data sources that solves this problem. When enabled on the resource, it eliminates the need for `lifecycle.ignore_changes` blocks by treating Atlas-managed values as part of the expected state rather than drift.
25
+
26
+
Additionally, the data sources provide `effective_*_specs` attributes (`effective_electable_specs`, `effective_analytics_specs`, `effective_read_only_specs`) that expose the actual provisioned values from Atlas, providing visibility into what Atlas has scaled to versus what was configured.
27
+
28
+
For more details, see [Auto-Scaling with Effective Fields](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/advanced_cluster#auto-scaling-with-effective-fields) documentation.
25
29
26
30
### module_existing approach
27
31
32
+
**This was the only available approach before `use_effective_fields` was introduced and is no longer recommended.** This section is included only for understanding migration from existing implementations. For new modules or when migrating, use the [module_effective_fields approach](#module_effective_fields-approach) (see [Migration Guide](#migration-guide) below).
33
+
28
34
Uses `mongodbatlas_advanced_cluster` resource with `lifecycle.ignore_changes` block listing all auto-scalable fields (instance_size, disk_size_gb, disk_iops) for all node types across regions and replication specs. When auto-scaling is enabled, Atlas may adjust all three fields regardless of which auto-scaling type is enabled (for optimal performance). Includes `mongodbatlas_advanced_cluster` data source to query actual provisioned values from Atlas API, as ignored fields are from the Terraform state.
29
35
30
36
**Known issues with this approach:**
@@ -58,16 +64,16 @@ See [module_effective_fields/main.tf](./module_effective_fields/main.tf) for imp
58
64
3.**Update outputs:** Reference data source for replication specs.
**Phase 2: Enhanced visibility (prepares for provider v3.x)**
67
+
**Phase 2: Enhanced visibility (prepares for future provider major versions)**
62
68
63
-
This breaking change prepares for provider v3.x where effective fields will be the default behavior:
69
+
Prepares for future provider major versions where effective fields will be the default behavior. This involves changes to data source outputs:
64
70
65
71
1.**Update data source:** Add `use_effective_fields = true` to data source.
66
72
2.**Update outputs:** Expose both configured specs and effective specs separately, or document that clients must use `effective_*_specs` for actual values.
67
-
3.**Update documentation:** Clearly communicate the breaking change - data source now returns both client-provided specs (via `*_specs`) and actual provisioned specs (via `effective_*_specs`). Clients must switch from using normal specs (which previously returned actual values) to using `effective_*_specs` to get actual values.
68
-
4.**Result:** Clear separation between configured intent and actual provisioned values, aligned with future v3.x behavior.
73
+
3.**Update documentation:** Clearly document that data source now returns both client-provided specs (via `*_specs`) and actual provisioned specs (via `effective_*_specs`). Clients must switch from using normal specs (which previously returned actual values) to using `effective_*_specs` to get actual values.
74
+
4.**Result:** Clear separation between configured intent and actual provisioned values, aligned with future provider major version behavior.
69
75
70
-
**Breaking change impact:** Module users accessing `*_specs` for actual provisioned values must switch to using `effective_*_specs` attributes (effective_electable_specs, effective_analytics_specs, effective_read_only_specs).
76
+
**Migration impact:** Module users accessing `*_specs` for actual provisioned values must switch to using `effective_*_specs` attributes (effective_electable_specs, effective_analytics_specs, effective_read_only_specs).
71
77
72
78
See detailed implementation in [module_existing](./module_existing/) and [module_effective_fields](./module_effective_fields/).
0 commit comments