Skip to content

Commit

Permalink
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 3, 2023
1 parent 561c7f2 commit fa5dbad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/controller/rds/dbinstance/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/crossplane-contrib/provider-aws/apis/v1alpha1"
aws "github.com/crossplane-contrib/provider-aws/pkg/clients"
dbinstance "github.com/crossplane-contrib/provider-aws/pkg/clients/rds"
svcutils "github.com/crossplane-contrib/provider-aws/pkg/controller/rds"
"github.com/crossplane-contrib/provider-aws/pkg/controller/rds/utils"
"github.com/crossplane-contrib/provider-aws/pkg/features"
)
Expand Down Expand Up @@ -450,6 +451,15 @@ func (e *custom) isUpToDate(cr *svcapitypes.DBInstance, out *svcsdk.DescribeDBIn
cmpopts.IgnoreFields(svcapitypes.CustomDBInstanceParameters{}, "DeleteAutomatedBackups"),
)

// for tagging: at least one option must be added, modified, or removed.
tagsUpToDate, _ := svcutils.AreTagsUpToDate(e.client, cr.Spec.ForProvider.Tags, cr.Status.AtProvider.DBInstanceARN)
if !tagsUpToDate {
err := svcutils.UpdateTagsForResource(e.client, cr.Spec.ForProvider.Tags, cr.Status.AtProvider.DBInstanceARN)
if err != nil {
return true, aws.Wrap(err, errDescribe)
}
}

if diff == "" && !maintenanceWindowChanged && !backupWindowChanged && !versionChanged && !vpcSGsChanged && !dbParameterGroupChanged && !optionGroupChanged {
return true, nil
}
Expand Down

0 comments on commit fa5dbad

Please sign in to comment.