Skip to content

Commit

Permalink
Merge pull request crossplane-contrib#2066 from akesser/bugfix/update…
Browse files Browse the repository at this point in the history
…-dbinstance-version

fix: add engine version for dbinstance update
  • Loading branch information
MisterMX authored Jun 11, 2024
2 parents a138e9f + 0f868a2 commit d17c9da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/clients/rds/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const (
ErrNoPasswordUpToDate = "cannot determine password up to date status"
ErrGetCachedPassword = "cannot get cached password"
ErrRetrievePasswordForUpdate = "cannot retrieve password for update"
ErrDescribe = "cannot describe dbinstance"
)

const (
Expand Down
10 changes: 10 additions & 0 deletions pkg/controller/rds/dbinstance/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,16 @@ func (e *custom) preUpdate(ctx context.Context, cr *svcapitypes.DBInstance, obj
obj.StorageThroughput = nil
}

input := GenerateDescribeDBInstancesInput(cr)

out, err := e.client.DescribeDBInstancesWithContext(ctx, input)
if err != nil {
return errors.Wrap(err, dbinstance.ErrDescribe)
}
if !isEngineVersionUpToDate(cr, out) && cr.Spec.ForProvider.EngineVersion != nil {
obj.EngineVersion = cr.Spec.ForProvider.EngineVersion // add EngineVersion if changed and no downgrade
}

return nil
}

Expand Down

0 comments on commit d17c9da

Please sign in to comment.