From 750e269b1000d9123cf2c06aba4f227a1031444d Mon Sep 17 00:00:00 2001 From: Sujay Kumar Suman Date: Thu, 16 Nov 2023 20:16:44 +0530 Subject: [PATCH] [ib] update rds/dbinstance to update tags if modified --- pkg/controller/rds/dbinstance/setup.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/controller/rds/dbinstance/setup.go b/pkg/controller/rds/dbinstance/setup.go index 38849473f9..8dc71a668c 100644 --- a/pkg/controller/rds/dbinstance/setup.go +++ b/pkg/controller/rds/dbinstance/setup.go @@ -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" ) @@ -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 @@ -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 {