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 d8e5222 commit b1629f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

PROJECT_NAME := provider-aws
PROJECT_REPO := github.com/crossplane-contrib/$(PROJECT_NAME)
VERSION := v0.42.0-ib

PLATFORMS ?= linux_amd64 linux_arm64

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 @@ -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 b1629f2

Please sign in to comment.