Skip to content

Commit d857fff

Browse files
adjust check to consider change in read only spec of different region config
1 parent 7870b3c commit d857fff

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

internal/service/advancedcluster/resource_advanced_cluster_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ func checkBlocks(instanceSize string) resource.TestCheckFunc {
16031603
"replication_specs.1.region_configs.0.analytics_specs.0.instance_size": "M10",
16041604
"replication_specs.1.region_configs.0.analytics_specs.0.node_count": "4",
16051605

1606-
"replication_specs.1.region_configs.1.read_only_specs.0.instance_size": "M10",
1606+
"replication_specs.1.region_configs.1.read_only_specs.0.instance_size": instanceSize,
16071607
"replication_specs.1.region_configs.1.read_only_specs.0.node_count": "2",
16081608
}
16091609
for repSpecsIdx := range 2 {

internal/service/advancedclustertpf/plan_modifier.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ func AdjustRegionConfigsChildren(ctx context.Context, diags *diag.Diagnostics, s
127127
if newPlanReadOnlySpecs == nil {
128128
newPlanReadOnlySpecs = new(TFSpecsModel) // start with null attributes if not present plan
129129
}
130-
baseReadOnlySpecs := stateReadOnlySpecs // using values directly from state if no electable specs are present in plan
130+
baseReadOnlySpecs := stateReadOnlySpecs // using values directly from state if no electable specs are present in plan
131131
if planElectableSpecInReplicationSpec != nil { // ensures values are taken from a defined electable spec if not present in current region config
132132
baseReadOnlySpecs = planElectableSpecInReplicationSpec
133133
}
134-
if planElectableSpecs != nil { // we favour plan electable spec defined in same region config over one defined in replication spec to be more future proof baseReadOnlySpecs = planElectableSpecs
134+
if planElectableSpecs != nil { // we favor plan electable spec defined in same region config over one defined in replication spec to be more future proof
135135
baseReadOnlySpecs = planElectableSpecs
136136
}
137137
copyAttrIfDestNotKnown(&baseReadOnlySpecs.DiskSizeGb, &newPlanReadOnlySpecs.DiskSizeGb)
@@ -194,8 +194,8 @@ func AdjustRegionConfigsChildren(ctx context.Context, diags *diag.Diagnostics, s
194194
}
195195

196196
func findDefinedElectableSpecInReplicationSpec(ctx context.Context, regionConfigs []TFRegionConfigsModel) *TFSpecsModel {
197-
for _, rc := range regionConfigs {
198-
electableSpecs := TFModelObject[TFSpecsModel](ctx, rc.ElectableSpecs)
197+
for i := range regionConfigs {
198+
electableSpecs := TFModelObject[TFSpecsModel](ctx, regionConfigs[i].ElectableSpecs)
199199
if electableSpecs != nil {
200200
return electableSpecs
201201
}

0 commit comments

Comments
 (0)