From d182f7337a4bc84a8a8e023bfba882825a58e099 Mon Sep 17 00:00:00 2001 From: Amine Hilaly Date: Wed, 2 Jun 2021 15:55:01 +0200 Subject: [PATCH] Patch the correct observed state after a `rm.ReadOne` call `resourceManager.ReadOne` is not returning the correct observed state when `sdkFind` returns with an error. Which is causing the reconciler to patch to wrong state (`desird` instead `observed`). This patch fixes this issue by passing the correct observed state to `onError`. --- templates/pkg/resource/manager.go.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/pkg/resource/manager.go.tpl b/templates/pkg/resource/manager.go.tpl index 181b3c65..f0150312 100644 --- a/templates/pkg/resource/manager.go.tpl +++ b/templates/pkg/resource/manager.go.tpl @@ -74,7 +74,7 @@ func (rm *resourceManager) ReadOne( } observed, err := rm.sdkFind(ctx, r) if err != nil { - return rm.onError(r, err) + return rm.onError(observed, err) } return rm.onSuccess(observed) }