Skip to content

Commit 1efa574

Browse files
committed
fix(cdb): [122119363]Optimize the change issue of the replica_zone_ids : command not found field in a single availability zone
1 parent 0431c1b commit 1efa574

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tencentcloud/services/crs/resource_tc_redis_instance.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ func resourceTencentCloudRedisInstanceRead(d *schema.ResourceData, meta interfac
641641
}
642642
}
643643

644-
if info.NodeSet != nil {
644+
if info.NodeSet != nil && len(info.NodeSet) > 0 {
645645
var zoneIds []int
646646
var nodeInfos []interface{}
647647
for i := range info.NodeSet {
@@ -670,6 +670,20 @@ func resourceTencentCloudRedisInstanceRead(d *schema.ResourceData, meta interfac
670670
if !zoneIdsEqual {
671671
_ = d.Set("replica_zone_ids", zoneIds)
672672
}
673+
674+
if replicaZonesOk && zoneIdsEqual {
675+
zoneIds := helper.InterfacesIntegers(replicaZones.([]interface{}))
676+
zoneIsSet := true
677+
for _, v := range zoneIds {
678+
if v != int(*info.ZoneId) {
679+
zoneIsSet = false
680+
break
681+
}
682+
}
683+
if zoneIsSet {
684+
_ = d.Set("replica_zone_ids", replicaZones)
685+
}
686+
}
673687
}
674688
//internal version: replace resourceTag begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
675689
tcClient := meta.(tccommon.ProviderMeta).GetAPIV3Conn()

0 commit comments

Comments
 (0)