Skip to content

Commit 196a2c4

Browse files
authored
fix: Adds support for unknown replication_specs in the plan modifier (#3652)
* fix: Adds support for unknown replication_specs in the plan modifier * chore: Add release note for fixing Value Conversion Error in mongodbatlas_advanced_cluster
1 parent d3fff61 commit 196a2c4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.changelog/3652.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
resource/mongodbatlas_advanced_cluster: Fixes `Value Conversion Error` when replication_specs are unknown
3+
```

internal/service/advancedclustertpf/resource.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ func (r *rs) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, res
108108
if diags.HasError() {
109109
return
110110
}
111+
// The replication specs can be unknown if the cluster depends on another resource.
112+
// useStateForUnknowns will try to convert the field to `Target Type: []advancedclustertpf.TFReplicationSpecsModel`.
113+
// But since the field is unknown the user gets an error: `Error: Value Conversion Error`.
114+
if plan.ReplicationSpecs.IsUnknown() {
115+
return
116+
}
111117

112118
useStateForUnknowns(ctx, diags, &state, &plan)
113119
if diags.HasError() {

0 commit comments

Comments
 (0)