@@ -613,7 +613,7 @@ func (rm *resourceManager) modifyReplicationGroup(
613613
614614 // SecurityGroupIds, EngineVersion
615615 if rm .securityGroupIdsDiffer (desired , latest , latestCacheCluster ) ||
616- delta .DifferentAt ("Spec.EngineVersion" ) {
616+ delta .DifferentAt ("Spec.EngineVersion" ) || delta . DifferentAt ( "Spec.Engine" ) || delta . DifferentAt ( "Spec.CacheParameterGroupName" ) {
617617 input := rm .newModifyReplicationGroupRequestPayload (desired , latest , latestCacheCluster , delta )
618618 resp , respErr := rm .sdkapi .ModifyReplicationGroup (ctx , input )
619619 rm .metrics .RecordAPICall ("UPDATE" , "ModifyReplicationGroup" , respErr )
@@ -622,7 +622,16 @@ func (rm *resourceManager) modifyReplicationGroup(
622622 return nil , respErr
623623 }
624624
625- return rm .setReplicationGroupOutput (ctx , desired , resp .ReplicationGroup )
625+ // The ModifyReplicationGroup API returns stale field Engine that don't
626+ // immediately reflect the requested changes, causing the controller to detect false
627+ // differences and trigger terminal conditions. Override these fields with the user's
628+ // intended values before passing to the generated setReplicationGroupOutput function.
629+ normalizedRG := * resp .ReplicationGroup
630+ if desired .ko .Spec .Engine != nil {
631+ normalizedRG .Engine = desired .ko .Spec .Engine
632+ }
633+
634+ return rm .setReplicationGroupOutput (ctx , desired , & normalizedRG )
626635 }
627636
628637 // no updates done
@@ -1169,6 +1178,16 @@ func (rm *resourceManager) newModifyReplicationGroupRequestPayload(
11691178 input .EngineVersion = desired .ko .Spec .EngineVersion
11701179 }
11711180
1181+ if delta .DifferentAt ("Spec.Engine" ) &&
1182+ desired .ko .Spec .Engine != nil {
1183+ input .Engine = desired .ko .Spec .Engine
1184+ }
1185+
1186+ if delta .DifferentAt ("Spec.CacheParameterGroupName" ) &&
1187+ desired .ko .Spec .CacheParameterGroupName != nil {
1188+ input .CacheParameterGroupName = desired .ko .Spec .CacheParameterGroupName
1189+ }
1190+
11721191 return input
11731192}
11741193
0 commit comments