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 4, 2023
1 parent 750afbf commit 7234924
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ on:
- master
- release-*
pull_request: {}
workflow_dispatch: {}
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g. v0.1.0)'
required: false

env:
# Common versions
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 7234924

Please sign in to comment.