Skip to content

Commit

Permalink
[ib] update rds/dbinstance to update tags if modified
Browse files Browse the repository at this point in the history
  • Loading branch information
ssuman2-infoblox committed Nov 16, 2023
1 parent 9c58197 commit 750e269
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/controller/rds/dbinstance/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
aws "github.com/crossplane-contrib/provider-aws/pkg/clients"
dbinstance "github.com/crossplane-contrib/provider-aws/pkg/clients/rds"
"github.com/crossplane-contrib/provider-aws/pkg/controller/rds/utils"
svcutils "github.com/crossplane-contrib/provider-aws/pkg/controller/rds/utils"
"github.com/crossplane-contrib/provider-aws/pkg/features"
)

Expand Down Expand Up @@ -423,7 +424,6 @@ func lateInitialize(in *svcapitypes.DBInstanceParameters, out *svcsdk.DescribeDB

func (e *custom) isUpToDate(ctx context.Context, cr *svcapitypes.DBInstance, out *svcsdk.DescribeDBInstancesOutput) (upToDate bool, diff string, err error) { //nolint:gocyclo
db := out.DBInstances[0]

patch, err := createPatch(out, &cr.Spec.ForProvider)
if err != nil {
return false, "", err
Expand Down Expand Up @@ -506,11 +506,15 @@ func (e *custom) isUpToDate(ctx context.Context, cr *svcapitypes.DBInstance, out
}
if tagsChanged {
diff += fmt.Sprintf("\nadd %d tag(s) and remove %d tag(s)", len(e.cache.addTags), len(e.cache.removeTags))
err = svcutils.UpdateTagsForResource(ctx, e.client, cr.Spec.ForProvider.Tags, cr.Status.AtProvider.DBInstanceARN)
if err != nil {
log.Printf("Failed to update tags. [ERROR]: %v", aws.Wrap(err, errDescribe))
}
}

log.Println(diff)

return false, diff, nil
return false, diff, err
}

func isEngineVersionUpToDate(cr *svcapitypes.DBInstance, out *svcsdk.DescribeDBInstancesOutput) bool {
Expand Down

0 comments on commit 750e269

Please sign in to comment.