Skip to content

Commit

Permalink
Merge pull request #1856 from wotolom/fix-rdsinstance-immutable-kmskeyid
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterMX authored Sep 1, 2023
2 parents ae4eda0 + 36dbee6 commit 0334e7b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/clients/database/rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,27 @@ func LateInitialize(in *v1beta1.RDSInstanceParameters, db *rdstypes.DBInstance)
if len(in.EnableCloudwatchLogsExports) == 0 && in.CloudwatchLogsExportConfiguration != nil {
in.EnableCloudwatchLogsExports = in.CloudwatchLogsExportConfiguration.EnableLogTypes
}

in.OptionGroupName = lateInitializeOptionGroupName(in.OptionGroupName, db.OptionGroupMemberships)

}

func lateInitializeOptionGroupName(inOptionGroupName *string, members []rdstypes.OptionGroupMembership) *string {

if inOptionGroupName == nil && len(members) != 0 {

for _, group := range members {
if group.OptionGroupName != nil && group.Status != nil {

// find the OptionGroup that is applied or will be applied to the DB
switch awsclients.StringValue(group.Status) {
case "in-sync", "applying", "pending-apply", "pending-maintenance-apply":
return group.OptionGroupName
}
}
}
}
return inOptionGroupName
}

// IsUpToDate checks whether there is a change in any of the modifiable fields.
Expand All @@ -680,6 +701,7 @@ func IsUpToDate(ctx context.Context, kube client.Client, r *v1beta1.RDSInstance,
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "AllowMajorVersionUpgrade"),
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "MasterPasswordSecretRef"),
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "OptionGroupName"),
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "KMSKeyID"),
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "EnableCloudwatchLogsExports"),
// TODO: remove deprecated field + code. Mapping to EnableCloudwatchLogsExports while in deprecation.
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "CloudwatchLogsExportConfiguration"),
Expand Down

0 comments on commit 0334e7b

Please sign in to comment.