From 4a95a581c47715a604841fc92faf398faec38bf5 Mon Sep 17 00:00:00 2001 From: Sjur Millidahl Date: Fri, 20 Dec 2024 14:16:31 +0100 Subject: [PATCH] fix(cloudian-sdk): user resource exists when it is upToDate --- internal/controller/user/user.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/controller/user/user.go b/internal/controller/user/user.go index c2ececd8..f38fb016 100644 --- a/internal/controller/user/user.go +++ b/internal/controller/user/user.go @@ -154,16 +154,18 @@ func (c *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex return managed.ExternalObservation{}, errors.Wrap(err, errListUsers) } + upToDate := isUpToDate(cr.Spec.ForProvider, users) + return managed.ExternalObservation{ // Return false when the external resource does not exist. This lets // the managed resource reconciler know that it needs to call Create to // (re)create the resource, or that it has successfully been deleted. - ResourceExists: true, + ResourceExists: upToDate, // Return false when the external resource exists, but it not up to date // with the desired managed resource state. This lets the managed // resource reconciler know that it needs to call Update. - ResourceUpToDate: isUpToDate(cr.Spec.ForProvider, users), + ResourceUpToDate: upToDate, // Return any details that may be required to connect to the external // resource. These will be stored as the connection secret.