Skip to content

Commit 5df6c83

Browse files
authored
Merge pull request #2262 from crossplane-contrib/backport/2261
Backport of #2261
2 parents 37280c9 + 1f11436 commit 5df6c83

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkg/controller/rds/dbcluster/setup.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,10 @@ func (e *custom) isUpToDate(ctx context.Context, cr *svcapitypes.DBCluster, out
587587
return false, "", nil
588588
}
589589

590+
if !isStorageTypeUpToDate(cr, out) {
591+
return false, "", nil
592+
}
593+
590594
if !isBackupRetentionPeriodUpToDate(cr, out) {
591595
return false, "", nil
592596
}
@@ -632,6 +636,22 @@ func (e *custom) isUpToDate(ctx context.Context, cr *svcapitypes.DBCluster, out
632636
return true, "", nil
633637
}
634638

639+
func isStorageTypeUpToDate(cr *svcapitypes.DBCluster, out *svcsdk.DescribeDBClustersOutput) bool {
640+
// If StorageType is not set by user, we do not need to check and accept AWS set default (or the current value)
641+
if cr.Spec.ForProvider.StorageType == nil {
642+
return true
643+
}
644+
645+
// AWS returns "" when StorageType is explicitly "aurora" (default for DBClusters with aurora engines)
646+
// see also note in AWS docs: https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBCluster.html
647+
if pointer.StringValue(cr.Spec.ForProvider.StorageType) == "aurora" &&
648+
pointer.StringValue(out.DBClusters[0].StorageType) == "" {
649+
return true
650+
}
651+
652+
return pointer.StringValue(cr.Spec.ForProvider.StorageType) == pointer.StringValue(out.DBClusters[0].StorageType)
653+
}
654+
635655
func isPreferredMaintenanceWindowUpToDate(cr *svcapitypes.DBCluster, out *svcsdk.DescribeDBClustersOutput) bool {
636656
// If PreferredMaintenanceWindow is not set, aws sets a random window
637657
// so we do not try to update in this case

0 commit comments

Comments
 (0)