diff --git a/pkg/controller/apigateway/apikey/zz_controller.go b/pkg/controller/apigateway/apikey/zz_controller.go index f8ded492b8..0b0bfb772f 100644 --- a/pkg/controller/apigateway/apikey/zz_controller.go +++ b/pkg/controller/apigateway/apikey/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateAPIKey(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/authorizer/zz_controller.go b/pkg/controller/apigateway/authorizer/zz_controller.go index 79f6d0c74f..ffafad7c23 100644 --- a/pkg/controller/apigateway/authorizer/zz_controller.go +++ b/pkg/controller/apigateway/authorizer/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateAuthorizer(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/basepathmapping/zz_controller.go b/pkg/controller/apigateway/basepathmapping/zz_controller.go index f758987d16..16fd45dc2a 100644 --- a/pkg/controller/apigateway/basepathmapping/zz_controller.go +++ b/pkg/controller/apigateway/basepathmapping/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateBasePathMapping(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/deployment/zz_controller.go b/pkg/controller/apigateway/deployment/zz_controller.go index 119a6a6269..cb5815b613 100644 --- a/pkg/controller/apigateway/deployment/zz_controller.go +++ b/pkg/controller/apigateway/deployment/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDeployment(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/documentationpart/zz_controller.go b/pkg/controller/apigateway/documentationpart/zz_controller.go index d22a0d922b..270545b571 100644 --- a/pkg/controller/apigateway/documentationpart/zz_controller.go +++ b/pkg/controller/apigateway/documentationpart/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDocumentationPart(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/documentationversion/zz_controller.go b/pkg/controller/apigateway/documentationversion/zz_controller.go index 949c8388de..ef17819b10 100644 --- a/pkg/controller/apigateway/documentationversion/zz_controller.go +++ b/pkg/controller/apigateway/documentationversion/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDocumentationVersion(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/domainname/zz_controller.go b/pkg/controller/apigateway/domainname/zz_controller.go index ae3f4383e5..668d6b0579 100644 --- a/pkg/controller/apigateway/domainname/zz_controller.go +++ b/pkg/controller/apigateway/domainname/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDomainName(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/gatewayresponse/zz_controller.go b/pkg/controller/apigateway/gatewayresponse/zz_controller.go index ff09bd6fad..2ecd32ca75 100644 --- a/pkg/controller/apigateway/gatewayresponse/zz_controller.go +++ b/pkg/controller/apigateway/gatewayresponse/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateGatewayResponse(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/integration/zz_controller.go b/pkg/controller/apigateway/integration/zz_controller.go index 042c441a5d..334047844f 100644 --- a/pkg/controller/apigateway/integration/zz_controller.go +++ b/pkg/controller/apigateway/integration/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateIntegration(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/integrationresponse/zz_controller.go b/pkg/controller/apigateway/integrationresponse/zz_controller.go index 78fd84ef85..c38533861e 100644 --- a/pkg/controller/apigateway/integrationresponse/zz_controller.go +++ b/pkg/controller/apigateway/integrationresponse/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateIntegrationResponse(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/method/zz_controller.go b/pkg/controller/apigateway/method/zz_controller.go index fddfe71698..502de2f319 100644 --- a/pkg/controller/apigateway/method/zz_controller.go +++ b/pkg/controller/apigateway/method/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateMethod(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/methodresponse/zz_controller.go b/pkg/controller/apigateway/methodresponse/zz_controller.go index 4ee4f81697..6b88c88d49 100644 --- a/pkg/controller/apigateway/methodresponse/zz_controller.go +++ b/pkg/controller/apigateway/methodresponse/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateMethodResponse(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/model/zz_controller.go b/pkg/controller/apigateway/model/zz_controller.go index 0f1d38916c..7e5c171689 100644 --- a/pkg/controller/apigateway/model/zz_controller.go +++ b/pkg/controller/apigateway/model/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateModel(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/requestvalidator/zz_controller.go b/pkg/controller/apigateway/requestvalidator/zz_controller.go index 3d9641576a..8c9c3e3be5 100644 --- a/pkg/controller/apigateway/requestvalidator/zz_controller.go +++ b/pkg/controller/apigateway/requestvalidator/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateRequestValidator(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/resource/zz_controller.go b/pkg/controller/apigateway/resource/zz_controller.go index ec006db0b0..278ce3afed 100644 --- a/pkg/controller/apigateway/resource/zz_controller.go +++ b/pkg/controller/apigateway/resource/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateResource(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/restapi/zz_controller.go b/pkg/controller/apigateway/restapi/zz_controller.go index 717398cd30..322ac4440e 100644 --- a/pkg/controller/apigateway/restapi/zz_controller.go +++ b/pkg/controller/apigateway/restapi/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateRestAPI(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/stage/zz_controller.go b/pkg/controller/apigateway/stage/zz_controller.go index 0db6b6271e..b44241eece 100644 --- a/pkg/controller/apigateway/stage/zz_controller.go +++ b/pkg/controller/apigateway/stage/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateStage(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/usageplan/zz_controller.go b/pkg/controller/apigateway/usageplan/zz_controller.go index d59a7bcbac..594f886688 100644 --- a/pkg/controller/apigateway/usageplan/zz_controller.go +++ b/pkg/controller/apigateway/usageplan/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateUsagePlan(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/usageplankey/zz_controller.go b/pkg/controller/apigateway/usageplankey/zz_controller.go index 75702d138b..6c27e5ef59 100644 --- a/pkg/controller/apigateway/usageplankey/zz_controller.go +++ b/pkg/controller/apigateway/usageplankey/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateUsagePlanKey(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigateway/vpclink/zz_controller.go b/pkg/controller/apigateway/vpclink/zz_controller.go index ccba977a1f..7887391fa1 100644 --- a/pkg/controller/apigateway/vpclink/zz_controller.go +++ b/pkg/controller/apigateway/vpclink/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateVPCLink(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigatewayv2/api/zz_controller.go b/pkg/controller/apigatewayv2/api/zz_controller.go index d09f08c239..8d555c22ef 100644 --- a/pkg/controller/apigatewayv2/api/zz_controller.go +++ b/pkg/controller/apigatewayv2/api/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateAPI(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigatewayv2/apimapping/zz_controller.go b/pkg/controller/apigatewayv2/apimapping/zz_controller.go index ae63acf938..eb6a6029e4 100644 --- a/pkg/controller/apigatewayv2/apimapping/zz_controller.go +++ b/pkg/controller/apigatewayv2/apimapping/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateAPIMapping(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigatewayv2/authorizer/zz_controller.go b/pkg/controller/apigatewayv2/authorizer/zz_controller.go index 3c4fcb60f5..db225fd881 100644 --- a/pkg/controller/apigatewayv2/authorizer/zz_controller.go +++ b/pkg/controller/apigatewayv2/authorizer/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateAuthorizer(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigatewayv2/deployment/zz_controller.go b/pkg/controller/apigatewayv2/deployment/zz_controller.go index b18af29883..27b6281be5 100644 --- a/pkg/controller/apigatewayv2/deployment/zz_controller.go +++ b/pkg/controller/apigatewayv2/deployment/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDeployment(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigatewayv2/domainname/zz_controller.go b/pkg/controller/apigatewayv2/domainname/zz_controller.go index 15efd5a09c..1aa2a3123f 100644 --- a/pkg/controller/apigatewayv2/domainname/zz_controller.go +++ b/pkg/controller/apigatewayv2/domainname/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDomainName(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigatewayv2/integration/zz_controller.go b/pkg/controller/apigatewayv2/integration/zz_controller.go index 8e6939c7b6..4eb85d3d5e 100644 --- a/pkg/controller/apigatewayv2/integration/zz_controller.go +++ b/pkg/controller/apigatewayv2/integration/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateIntegration(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigatewayv2/integrationresponse/zz_controller.go b/pkg/controller/apigatewayv2/integrationresponse/zz_controller.go index c26a619567..2c7f7dedce 100644 --- a/pkg/controller/apigatewayv2/integrationresponse/zz_controller.go +++ b/pkg/controller/apigatewayv2/integrationresponse/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateIntegrationResponse(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigatewayv2/model/zz_controller.go b/pkg/controller/apigatewayv2/model/zz_controller.go index 16f5a85a3a..5608adb8dc 100644 --- a/pkg/controller/apigatewayv2/model/zz_controller.go +++ b/pkg/controller/apigatewayv2/model/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateModel(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigatewayv2/route/zz_controller.go b/pkg/controller/apigatewayv2/route/zz_controller.go index 08071a6985..9d1e6f840b 100644 --- a/pkg/controller/apigatewayv2/route/zz_controller.go +++ b/pkg/controller/apigatewayv2/route/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateRoute(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigatewayv2/routeresponse/zz_controller.go b/pkg/controller/apigatewayv2/routeresponse/zz_controller.go index a42e6ec66d..b411ca92de 100644 --- a/pkg/controller/apigatewayv2/routeresponse/zz_controller.go +++ b/pkg/controller/apigatewayv2/routeresponse/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateRouteResponse(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigatewayv2/stage/zz_controller.go b/pkg/controller/apigatewayv2/stage/zz_controller.go index bb67c8423d..70c1809018 100644 --- a/pkg/controller/apigatewayv2/stage/zz_controller.go +++ b/pkg/controller/apigatewayv2/stage/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateStage(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/apigatewayv2/vpclink/zz_controller.go b/pkg/controller/apigatewayv2/vpclink/zz_controller.go index ef3d334721..9d24350d68 100644 --- a/pkg/controller/apigatewayv2/vpclink/zz_controller.go +++ b/pkg/controller/apigatewayv2/vpclink/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateVPCLink(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/athena/workgroup/zz_controller.go b/pkg/controller/athena/workgroup/zz_controller.go index 2a04a5b3db..508113b0b8 100644 --- a/pkg/controller/athena/workgroup/zz_controller.go +++ b/pkg/controller/athena/workgroup/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateWorkGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/autoscaling/autoscalinggroup/zz_controller.go b/pkg/controller/autoscaling/autoscalinggroup/zz_controller.go index 835d890ba2..d372f90691 100644 --- a/pkg/controller/autoscaling/autoscalinggroup/zz_controller.go +++ b/pkg/controller/autoscaling/autoscalinggroup/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateAutoScalingGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/batch/computeenvironment/zz_controller.go b/pkg/controller/batch/computeenvironment/zz_controller.go index 85d12d1ccc..1aec32e8f7 100644 --- a/pkg/controller/batch/computeenvironment/zz_controller.go +++ b/pkg/controller/batch/computeenvironment/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateComputeEnvironment(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/batch/jobqueue/zz_controller.go b/pkg/controller/batch/jobqueue/zz_controller.go index f30693dd55..99d38e42e4 100644 --- a/pkg/controller/batch/jobqueue/zz_controller.go +++ b/pkg/controller/batch/jobqueue/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateJobQueue(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/cloudfront/cachepolicy/zz_controller.go b/pkg/controller/cloudfront/cachepolicy/zz_controller.go index 72a895666c..9c3f1422c9 100644 --- a/pkg/controller/cloudfront/cachepolicy/zz_controller.go +++ b/pkg/controller/cloudfront/cachepolicy/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateCachePolicy(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/cloudfront/cloudfrontoriginaccessidentity/zz_controller.go b/pkg/controller/cloudfront/cloudfrontoriginaccessidentity/zz_controller.go index 4ef812a8b5..4281368b85 100644 --- a/pkg/controller/cloudfront/cloudfrontoriginaccessidentity/zz_controller.go +++ b/pkg/controller/cloudfront/cloudfrontoriginaccessidentity/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateCloudFrontOriginAccessIdentity(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/cloudfront/distribution/zz_controller.go b/pkg/controller/cloudfront/distribution/zz_controller.go index dbf96685d3..8d0f254cea 100644 --- a/pkg/controller/cloudfront/distribution/zz_controller.go +++ b/pkg/controller/cloudfront/distribution/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDistribution(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/cloudfront/responseheaderspolicy/zz_controller.go b/pkg/controller/cloudfront/responseheaderspolicy/zz_controller.go index 9c34971748..fd86e9d01e 100644 --- a/pkg/controller/cloudfront/responseheaderspolicy/zz_controller.go +++ b/pkg/controller/cloudfront/responseheaderspolicy/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateResponseHeadersPolicy(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/cloudsearch/domain/zz_controller.go b/pkg/controller/cloudsearch/domain/zz_controller.go index 9155092bcc..c6d2b3904e 100644 --- a/pkg/controller/cloudsearch/domain/zz_controller.go +++ b/pkg/controller/cloudsearch/domain/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDomain(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/cloudwatchlogs/loggroup/zz_controller.go b/pkg/controller/cloudwatchlogs/loggroup/zz_controller.go index 9f2943159d..224b30d4b5 100644 --- a/pkg/controller/cloudwatchlogs/loggroup/zz_controller.go +++ b/pkg/controller/cloudwatchlogs/loggroup/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateLogGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/cognitoidentityprovider/group/zz_controller.go b/pkg/controller/cognitoidentityprovider/group/zz_controller.go index 9d1516f8b5..56bd19e6a6 100644 --- a/pkg/controller/cognitoidentityprovider/group/zz_controller.go +++ b/pkg/controller/cognitoidentityprovider/group/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/cognitoidentityprovider/identityprovider/zz_controller.go b/pkg/controller/cognitoidentityprovider/identityprovider/zz_controller.go index 1b4b88464a..6b36aee5c4 100644 --- a/pkg/controller/cognitoidentityprovider/identityprovider/zz_controller.go +++ b/pkg/controller/cognitoidentityprovider/identityprovider/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateIdentityProvider(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/cognitoidentityprovider/resourceserver/zz_controller.go b/pkg/controller/cognitoidentityprovider/resourceserver/zz_controller.go index ad8cdbfe30..aee61dd3d6 100644 --- a/pkg/controller/cognitoidentityprovider/resourceserver/zz_controller.go +++ b/pkg/controller/cognitoidentityprovider/resourceserver/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateResourceServer(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/cognitoidentityprovider/userpool/zz_controller.go b/pkg/controller/cognitoidentityprovider/userpool/zz_controller.go index 3260479bf3..5f4194c0a2 100644 --- a/pkg/controller/cognitoidentityprovider/userpool/zz_controller.go +++ b/pkg/controller/cognitoidentityprovider/userpool/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateUserPool(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/cognitoidentityprovider/userpoolclient/zz_controller.go b/pkg/controller/cognitoidentityprovider/userpoolclient/zz_controller.go index 1efc2fbd64..d037865ad4 100644 --- a/pkg/controller/cognitoidentityprovider/userpoolclient/zz_controller.go +++ b/pkg/controller/cognitoidentityprovider/userpoolclient/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateUserPoolClient(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/cognitoidentityprovider/userpooldomain/zz_controller.go b/pkg/controller/cognitoidentityprovider/userpooldomain/zz_controller.go index 9adb2c0baf..da001f9cf4 100644 --- a/pkg/controller/cognitoidentityprovider/userpooldomain/zz_controller.go +++ b/pkg/controller/cognitoidentityprovider/userpooldomain/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateUserPoolDomain(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/dax/cluster/zz_controller.go b/pkg/controller/dax/cluster/zz_controller.go index 52df69ebe8..ec6f3840ea 100644 --- a/pkg/controller/dax/cluster/zz_controller.go +++ b/pkg/controller/dax/cluster/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateCluster(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/dax/parametergroup/zz_controller.go b/pkg/controller/dax/parametergroup/zz_controller.go index 6862fef980..0c7489c339 100644 --- a/pkg/controller/dax/parametergroup/zz_controller.go +++ b/pkg/controller/dax/parametergroup/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateParameterGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/dax/subnetgroup/zz_controller.go b/pkg/controller/dax/subnetgroup/zz_controller.go index 8e8bba14f7..5e9dfa5625 100644 --- a/pkg/controller/dax/subnetgroup/zz_controller.go +++ b/pkg/controller/dax/subnetgroup/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateSubnetGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/docdb/dbcluster/setup.go b/pkg/controller/docdb/dbcluster/setup.go index 62df43808e..b4d231a8bc 100644 --- a/pkg/controller/docdb/dbcluster/setup.go +++ b/pkg/controller/docdb/dbcluster/setup.go @@ -123,10 +123,11 @@ func (e *hooks) postObserve(ctx context.Context, cr *svcapitypes.DBCluster, resp obs.ConnectionDetails = getConnectionDetails(cr) - pw, _, _ := e.getPasswordFromRef(ctx, cr.Spec.ForProvider.MasterUserPasswordSecretRef, cr.Spec.WriteConnectionSecretToReference) - - if pw != "" { - obs.ConnectionDetails[xpv1.ResourceCredentialsSecretPasswordKey] = []byte(pw) + if !meta.WasDeleted(cr) { + pw, _, _ := e.getPasswordFromRef(ctx, cr.Spec.ForProvider.MasterUserPasswordSecretRef, cr.Spec.WriteConnectionSecretToReference) + if pw != "" { + obs.ConnectionDetails[xpv1.ResourceCredentialsSecretPasswordKey] = []byte(pw) + } } switch pointer.StringValue(cr.Status.AtProvider.Status) { @@ -174,10 +175,6 @@ func lateInitialize(cr *svcapitypes.DBClusterParameters, resp *svcsdk.DescribeDB } func (e *hooks) isUpToDate(ctx context.Context, cr *svcapitypes.DBCluster, resp *svcsdk.DescribeDBClustersOutput) (bool, string, error) { - if meta.WasDeleted(cr) { - return true, "", nil // There is no need to check for updates when we want to delete. - } - cluster := resp.DBClusters[0] _, pwChanged, err := e.getPasswordFromRef(ctx, cr.Spec.ForProvider.MasterUserPasswordSecretRef, cr.Spec.WriteConnectionSecretToReference) diff --git a/pkg/controller/docdb/dbcluster/setup_test.go b/pkg/controller/docdb/dbcluster/setup_test.go index 57e0521231..18aefb1318 100644 --- a/pkg/controller/docdb/dbcluster/setup_test.go +++ b/pkg/controller/docdb/dbcluster/setup_test.go @@ -1747,12 +1747,14 @@ func TestObserve(t *testing.T) { withDeletionTimestamp(&metav1.Time{Time: timeNow}), withPreferredMaintenanceWindow(testOtherPreferredMaintenanceWindow), withExternalName(testDBClusterIdentifier), + withConditions(xpv1.Available()), withStatus(svcapitypes.DocDBInstanceStateAvailable), withVpcSecurityGroupIds(), ), result: managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, + ResourceExists: true, + ResourceUpToDate: true, + ConnectionDetails: generateConnectionDetails("", "", "", "", 0), }, docdb: fake.MockDocDBClientCall{ DescribeDBClustersWithContext: []*fake.CallDescribeDBClustersWithContext{ diff --git a/pkg/controller/docdb/dbcluster/zz_controller.go b/pkg/controller/docdb/dbcluster/zz_controller.go index 95ff3fb912..e7e24c235c 100644 --- a/pkg/controller/docdb/dbcluster/zz_controller.go +++ b/pkg/controller/docdb/dbcluster/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDBCluster(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/docdb/dbclusterparametergroup/zz_controller.go b/pkg/controller/docdb/dbclusterparametergroup/zz_controller.go index e5ac4ec63f..833bc84e4c 100644 --- a/pkg/controller/docdb/dbclusterparametergroup/zz_controller.go +++ b/pkg/controller/docdb/dbclusterparametergroup/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDBClusterParameterGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/docdb/dbinstance/zz_controller.go b/pkg/controller/docdb/dbinstance/zz_controller.go index 2db9d0c932..67b0369bf2 100644 --- a/pkg/controller/docdb/dbinstance/zz_controller.go +++ b/pkg/controller/docdb/dbinstance/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDBInstance(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/docdb/dbsubnetgroup/zz_controller.go b/pkg/controller/docdb/dbsubnetgroup/zz_controller.go index 0c6fe47e8d..0b5e1274dc 100644 --- a/pkg/controller/docdb/dbsubnetgroup/zz_controller.go +++ b/pkg/controller/docdb/dbsubnetgroup/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDBSubnetGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/dynamodb/backup/zz_controller.go b/pkg/controller/dynamodb/backup/zz_controller.go index 4966697b4b..db3f3b08d7 100644 --- a/pkg/controller/dynamodb/backup/zz_controller.go +++ b/pkg/controller/dynamodb/backup/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateBackup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/dynamodb/globaltable/zz_controller.go b/pkg/controller/dynamodb/globaltable/zz_controller.go index d161c3dc11..0fceafa9a7 100644 --- a/pkg/controller/dynamodb/globaltable/zz_controller.go +++ b/pkg/controller/dynamodb/globaltable/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateGlobalTable(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/dynamodb/table/zz_controller.go b/pkg/controller/dynamodb/table/zz_controller.go index 173ea24e6a..5f9cac2e53 100644 --- a/pkg/controller/dynamodb/table/zz_controller.go +++ b/pkg/controller/dynamodb/table/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateTable(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ec2/flowlog/zz_controller.go b/pkg/controller/ec2/flowlog/zz_controller.go index fa90b53876..c7dcc416f2 100644 --- a/pkg/controller/ec2/flowlog/zz_controller.go +++ b/pkg/controller/ec2/flowlog/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateFlowLog(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ec2/launchtemplate/zz_controller.go b/pkg/controller/ec2/launchtemplate/zz_controller.go index d5b3697bf4..eb8e1f152c 100644 --- a/pkg/controller/ec2/launchtemplate/zz_controller.go +++ b/pkg/controller/ec2/launchtemplate/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateLaunchTemplate(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ec2/launchtemplateversion/zz_controller.go b/pkg/controller/ec2/launchtemplateversion/zz_controller.go index 3857cd4819..3184ab47d5 100644 --- a/pkg/controller/ec2/launchtemplateversion/zz_controller.go +++ b/pkg/controller/ec2/launchtemplateversion/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateLaunchTemplateVersion(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ec2/transitgateway/zz_controller.go b/pkg/controller/ec2/transitgateway/zz_controller.go index 93cadfc814..d02c6f87bc 100644 --- a/pkg/controller/ec2/transitgateway/zz_controller.go +++ b/pkg/controller/ec2/transitgateway/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateTransitGateway(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ec2/transitgatewayroutetable/zz_controller.go b/pkg/controller/ec2/transitgatewayroutetable/zz_controller.go index a7b3e68d5d..2ace636964 100644 --- a/pkg/controller/ec2/transitgatewayroutetable/zz_controller.go +++ b/pkg/controller/ec2/transitgatewayroutetable/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateTransitGatewayRouteTable(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ec2/transitgatewayvpcattachment/zz_controller.go b/pkg/controller/ec2/transitgatewayvpcattachment/zz_controller.go index 98605c3003..01516ae790 100644 --- a/pkg/controller/ec2/transitgatewayvpcattachment/zz_controller.go +++ b/pkg/controller/ec2/transitgatewayvpcattachment/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateTransitGatewayVPCAttachment(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ec2/volume/zz_controller.go b/pkg/controller/ec2/volume/zz_controller.go index 588269d774..928a1b0219 100644 --- a/pkg/controller/ec2/volume/zz_controller.go +++ b/pkg/controller/ec2/volume/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateVolume(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ec2/vpcendpoint/zz_controller.go b/pkg/controller/ec2/vpcendpoint/zz_controller.go index 39504cda3b..6c847b2b91 100644 --- a/pkg/controller/ec2/vpcendpoint/zz_controller.go +++ b/pkg/controller/ec2/vpcendpoint/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateVPCEndpoint(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ec2/vpcendpointserviceconfiguration/zz_controller.go b/pkg/controller/ec2/vpcendpointserviceconfiguration/zz_controller.go index 4713081e7d..3da67589e6 100644 --- a/pkg/controller/ec2/vpcendpointserviceconfiguration/zz_controller.go +++ b/pkg/controller/ec2/vpcendpointserviceconfiguration/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateVPCEndpointServiceConfiguration(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ec2/vpcpeeringconnection/zz_controller.go b/pkg/controller/ec2/vpcpeeringconnection/zz_controller.go index b529fa6ccf..0239be3f54 100644 --- a/pkg/controller/ec2/vpcpeeringconnection/zz_controller.go +++ b/pkg/controller/ec2/vpcpeeringconnection/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateVPCPeeringConnection(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ecr/lifecyclepolicy/zz_controller.go b/pkg/controller/ecr/lifecyclepolicy/zz_controller.go index 6230cbd23b..585477d126 100644 --- a/pkg/controller/ecr/lifecyclepolicy/zz_controller.go +++ b/pkg/controller/ecr/lifecyclepolicy/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateLifecyclePolicy(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ecs/cluster/zz_controller.go b/pkg/controller/ecs/cluster/zz_controller.go index 35ac5ef162..8cf9a6411f 100644 --- a/pkg/controller/ecs/cluster/zz_controller.go +++ b/pkg/controller/ecs/cluster/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateCluster(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ecs/service/zz_controller.go b/pkg/controller/ecs/service/zz_controller.go index 57f2cd6d2f..c7573bf96c 100644 --- a/pkg/controller/ecs/service/zz_controller.go +++ b/pkg/controller/ecs/service/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateService(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ecs/taskdefinition/zz_controller.go b/pkg/controller/ecs/taskdefinition/zz_controller.go index 7d190df936..8de2ee0af1 100644 --- a/pkg/controller/ecs/taskdefinition/zz_controller.go +++ b/pkg/controller/ecs/taskdefinition/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateTaskDefinition(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/efs/accesspoint/zz_controller.go b/pkg/controller/efs/accesspoint/zz_controller.go index e9ecb62bea..c8947dc1b0 100644 --- a/pkg/controller/efs/accesspoint/zz_controller.go +++ b/pkg/controller/efs/accesspoint/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateAccessPoint(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/efs/filesystem/zz_controller.go b/pkg/controller/efs/filesystem/zz_controller.go index 7251182681..f088f127e0 100644 --- a/pkg/controller/efs/filesystem/zz_controller.go +++ b/pkg/controller/efs/filesystem/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateFileSystem(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/efs/mounttarget/zz_controller.go b/pkg/controller/efs/mounttarget/zz_controller.go index 38c34c7fcc..a3bddd61b8 100644 --- a/pkg/controller/efs/mounttarget/zz_controller.go +++ b/pkg/controller/efs/mounttarget/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateMountTarget(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/eks/addon/zz_controller.go b/pkg/controller/eks/addon/zz_controller.go index 174fa2dc8c..4aefaa76b9 100644 --- a/pkg/controller/eks/addon/zz_controller.go +++ b/pkg/controller/eks/addon/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateAddon(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/elasticache/cacheparametergroup/zz_controller.go b/pkg/controller/elasticache/cacheparametergroup/zz_controller.go index d1318247f6..7fbb81568a 100644 --- a/pkg/controller/elasticache/cacheparametergroup/zz_controller.go +++ b/pkg/controller/elasticache/cacheparametergroup/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateCacheParameterGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/elbv2/listener/zz_controller.go b/pkg/controller/elbv2/listener/zz_controller.go index 6a1d6d0a0d..9312bac970 100644 --- a/pkg/controller/elbv2/listener/zz_controller.go +++ b/pkg/controller/elbv2/listener/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateListener(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/elbv2/loadbalancer/zz_controller.go b/pkg/controller/elbv2/loadbalancer/zz_controller.go index 76f10be75f..63a914d9bf 100644 --- a/pkg/controller/elbv2/loadbalancer/zz_controller.go +++ b/pkg/controller/elbv2/loadbalancer/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateLoadBalancer(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/elbv2/targetgroup/zz_controller.go b/pkg/controller/elbv2/targetgroup/zz_controller.go index b70064ddae..21ddfa4d10 100644 --- a/pkg/controller/elbv2/targetgroup/zz_controller.go +++ b/pkg/controller/elbv2/targetgroup/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateTargetGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/emrcontainers/jobrun/zz_controller.go b/pkg/controller/emrcontainers/jobrun/zz_controller.go index a99108e07c..b874f23de9 100644 --- a/pkg/controller/emrcontainers/jobrun/zz_controller.go +++ b/pkg/controller/emrcontainers/jobrun/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateJobRun(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/emrcontainers/virtualcluster/zz_controller.go b/pkg/controller/emrcontainers/virtualcluster/zz_controller.go index 927ed2867d..00679608ac 100644 --- a/pkg/controller/emrcontainers/virtualcluster/zz_controller.go +++ b/pkg/controller/emrcontainers/virtualcluster/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateVirtualCluster(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/firehose/deliverystream/zz_controller.go b/pkg/controller/firehose/deliverystream/zz_controller.go index 205f859bda..de4c895732 100644 --- a/pkg/controller/firehose/deliverystream/zz_controller.go +++ b/pkg/controller/firehose/deliverystream/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDeliveryStream(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/globalaccelerator/accelerator/zz_controller.go b/pkg/controller/globalaccelerator/accelerator/zz_controller.go index fb6398ebfd..6a0c3288e3 100644 --- a/pkg/controller/globalaccelerator/accelerator/zz_controller.go +++ b/pkg/controller/globalaccelerator/accelerator/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateAccelerator(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/globalaccelerator/endpointgroup/zz_controller.go b/pkg/controller/globalaccelerator/endpointgroup/zz_controller.go index 58a640e0ce..d93be50ac9 100644 --- a/pkg/controller/globalaccelerator/endpointgroup/zz_controller.go +++ b/pkg/controller/globalaccelerator/endpointgroup/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateEndpointGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/globalaccelerator/listener/zz_controller.go b/pkg/controller/globalaccelerator/listener/zz_controller.go index 416357ae92..959be506ad 100644 --- a/pkg/controller/globalaccelerator/listener/zz_controller.go +++ b/pkg/controller/globalaccelerator/listener/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateListener(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/glue/classifier/zz_controller.go b/pkg/controller/glue/classifier/zz_controller.go index 0864a62738..a24f25067a 100644 --- a/pkg/controller/glue/classifier/zz_controller.go +++ b/pkg/controller/glue/classifier/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateClassifier(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/glue/connection/setup.go b/pkg/controller/glue/connection/setup.go index a2c062867b..78732168c1 100644 --- a/pkg/controller/glue/connection/setup.go +++ b/pkg/controller/glue/connection/setup.go @@ -127,13 +127,6 @@ func postObserve(ctx context.Context, cr *svcapitypes.Connection, obj *svcsdk.Ge } func (h *hooks) isUpToDate(_ context.Context, cr *svcapitypes.Connection, resp *svcsdk.GetConnectionOutput) (bool, string, error) { - - // no checks needed if user deletes the resource - // ensures that an error (e.g. missing ARN) here does not prevent deletion - if meta.WasDeleted(cr) { - return true, "", nil - } - currentParams := customGenerateConnection(resp).Spec.ForProvider if diff := cmp.Diff(cr.Spec.ForProvider, currentParams, cmpopts.EquateEmpty(), diff --git a/pkg/controller/glue/connection/zz_controller.go b/pkg/controller/glue/connection/zz_controller.go index 23d830deb8..ce1d40d166 100644 --- a/pkg/controller/glue/connection/zz_controller.go +++ b/pkg/controller/glue/connection/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateConnection(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/glue/crawler/setup.go b/pkg/controller/glue/crawler/setup.go index 23bb5d6803..446b4a2ceb 100644 --- a/pkg/controller/glue/crawler/setup.go +++ b/pkg/controller/glue/crawler/setup.go @@ -206,12 +206,6 @@ func lateInitialize(spec *svcapitypes.CrawlerParameters, resp *svcsdk.GetCrawler } func (h *hooks) isUpToDate(_ context.Context, cr *svcapitypes.Crawler, resp *svcsdk.GetCrawlerOutput) (bool, string, error) { - // no checks needed if user deletes the resource - // ensures that an error (e.g. missing ARN) here does not prevent deletion - if meta.WasDeleted(cr) { - return true, "", nil - } - currentParams := customGenerateCrawler(resp).Spec.ForProvider // separate check bc: 1.lowercase handling 2.field Schedule has different input/output shapes (see generator-config.yaml) diff --git a/pkg/controller/glue/crawler/zz_controller.go b/pkg/controller/glue/crawler/zz_controller.go index d175ecde64..28a2ad7b1e 100644 --- a/pkg/controller/glue/crawler/zz_controller.go +++ b/pkg/controller/glue/crawler/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateCrawler(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/glue/database/zz_controller.go b/pkg/controller/glue/database/zz_controller.go index ee22e7d91c..ad77838e16 100644 --- a/pkg/controller/glue/database/zz_controller.go +++ b/pkg/controller/glue/database/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDatabase(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/glue/job/setup.go b/pkg/controller/glue/job/setup.go index 658ec28a06..c3501ef2d8 100644 --- a/pkg/controller/glue/job/setup.go +++ b/pkg/controller/glue/job/setup.go @@ -154,12 +154,6 @@ func lateInitialize(spec *svcapitypes.JobParameters, resp *svcsdk.GetJobOutput) } func (h *hooks) isUpToDate(_ context.Context, cr *svcapitypes.Job, resp *svcsdk.GetJobOutput) (bool, string, error) { - // no checks needed if user deletes the resource - // ensures that an error (e.g. missing ARN) here does not prevent deletion - if meta.WasDeleted(cr) { - return true, "", nil - } - currentParams := customGenerateJob(resp).Spec.ForProvider if diff := cmp.Diff(cr.Spec.ForProvider, currentParams, cmpopts.EquateEmpty(), diff --git a/pkg/controller/glue/job/zz_controller.go b/pkg/controller/glue/job/zz_controller.go index b3c474e13c..7f57383936 100644 --- a/pkg/controller/glue/job/zz_controller.go +++ b/pkg/controller/glue/job/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateJob(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/glue/securityconfiguration/zz_controller.go b/pkg/controller/glue/securityconfiguration/zz_controller.go index 5aa65885a4..7467889ea7 100644 --- a/pkg/controller/glue/securityconfiguration/zz_controller.go +++ b/pkg/controller/glue/securityconfiguration/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateSecurityConfiguration(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/iam/instanceprofile/zz_controller.go b/pkg/controller/iam/instanceprofile/zz_controller.go index 8b33ed49ec..bd52fdcbca 100644 --- a/pkg/controller/iam/instanceprofile/zz_controller.go +++ b/pkg/controller/iam/instanceprofile/zz_controller.go @@ -85,15 +85,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateInstanceProfile(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/iot/policy/zz_controller.go b/pkg/controller/iot/policy/zz_controller.go index 55ea4e4b00..a6c125c5eb 100644 --- a/pkg/controller/iot/policy/zz_controller.go +++ b/pkg/controller/iot/policy/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GeneratePolicy(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/iot/thing/zz_controller.go b/pkg/controller/iot/thing/zz_controller.go index 80a086d79b..aad67e410d 100644 --- a/pkg/controller/iot/thing/zz_controller.go +++ b/pkg/controller/iot/thing/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateThing(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/kafka/cluster/zz_controller.go b/pkg/controller/kafka/cluster/zz_controller.go index d82f328af7..624136dbad 100644 --- a/pkg/controller/kafka/cluster/zz_controller.go +++ b/pkg/controller/kafka/cluster/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateCluster(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/kafka/configuration/zz_controller.go b/pkg/controller/kafka/configuration/zz_controller.go index 520b143b51..bb49207900 100644 --- a/pkg/controller/kafka/configuration/zz_controller.go +++ b/pkg/controller/kafka/configuration/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateConfiguration(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/kinesis/stream/zz_controller.go b/pkg/controller/kinesis/stream/zz_controller.go index c253b10e2a..40e16d811f 100644 --- a/pkg/controller/kinesis/stream/zz_controller.go +++ b/pkg/controller/kinesis/stream/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateStream(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/kms/grant/zz_controller.go b/pkg/controller/kms/grant/zz_controller.go index 19549f8337..7d99dc6bee 100644 --- a/pkg/controller/kms/grant/zz_controller.go +++ b/pkg/controller/kms/grant/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateGrant(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/kms/key/zz_controller.go b/pkg/controller/kms/key/zz_controller.go index e9543c3299..25dc5352d6 100644 --- a/pkg/controller/kms/key/zz_controller.go +++ b/pkg/controller/kms/key/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateKey(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/lambda/function/zz_controller.go b/pkg/controller/lambda/function/zz_controller.go index 79141ca1b6..fa2050e1d5 100644 --- a/pkg/controller/lambda/function/zz_controller.go +++ b/pkg/controller/lambda/function/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateFunction(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/lambda/functionurlconfig/zz_controller.go b/pkg/controller/lambda/functionurlconfig/zz_controller.go index 3890a733b9..ddd2bc7f93 100644 --- a/pkg/controller/lambda/functionurlconfig/zz_controller.go +++ b/pkg/controller/lambda/functionurlconfig/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateFunctionURLConfig(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/mq/broker/zz_controller.go b/pkg/controller/mq/broker/zz_controller.go index d71bc3d78a..77d6e4c95a 100644 --- a/pkg/controller/mq/broker/zz_controller.go +++ b/pkg/controller/mq/broker/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateBroker(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/mq/user/zz_controller.go b/pkg/controller/mq/user/zz_controller.go index 23ff9e853c..80f1e9a6a0 100644 --- a/pkg/controller/mq/user/zz_controller.go +++ b/pkg/controller/mq/user/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateUser(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/mwaa/environment/zz_controller.go b/pkg/controller/mwaa/environment/zz_controller.go index f4fc684792..6c2e0117ec 100644 --- a/pkg/controller/mwaa/environment/zz_controller.go +++ b/pkg/controller/mwaa/environment/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateEnvironment(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/neptune/dbcluster/zz_controller.go b/pkg/controller/neptune/dbcluster/zz_controller.go index 887fe5e5d3..0600028f1d 100644 --- a/pkg/controller/neptune/dbcluster/zz_controller.go +++ b/pkg/controller/neptune/dbcluster/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDBCluster(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/opensearchservice/domain/zz_controller.go b/pkg/controller/opensearchservice/domain/zz_controller.go index c723654da3..7de6d08178 100644 --- a/pkg/controller/opensearchservice/domain/zz_controller.go +++ b/pkg/controller/opensearchservice/domain/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDomain(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/prometheusservice/alertmanagerdefinition/zz_controller.go b/pkg/controller/prometheusservice/alertmanagerdefinition/zz_controller.go index 162676ca2b..e87d683959 100644 --- a/pkg/controller/prometheusservice/alertmanagerdefinition/zz_controller.go +++ b/pkg/controller/prometheusservice/alertmanagerdefinition/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateAlertManagerDefinition(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/prometheusservice/rulegroupsnamespace/zz_controller.go b/pkg/controller/prometheusservice/rulegroupsnamespace/zz_controller.go index ff648f7c8a..511b551314 100644 --- a/pkg/controller/prometheusservice/rulegroupsnamespace/zz_controller.go +++ b/pkg/controller/prometheusservice/rulegroupsnamespace/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateRuleGroupsNamespace(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/prometheusservice/workspace/zz_controller.go b/pkg/controller/prometheusservice/workspace/zz_controller.go index b4498ac422..310d21d06c 100644 --- a/pkg/controller/prometheusservice/workspace/zz_controller.go +++ b/pkg/controller/prometheusservice/workspace/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateWorkspace(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/ram/resourceshare/zz_controller.go b/pkg/controller/ram/resourceshare/zz_controller.go index 4e93c68b57..4dd24898e9 100644 --- a/pkg/controller/ram/resourceshare/zz_controller.go +++ b/pkg/controller/ram/resourceshare/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateResourceShare(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/rds/dbcluster/setup.go b/pkg/controller/rds/dbcluster/setup.go index 32fdff099e..cc9e5cb9ff 100644 --- a/pkg/controller/rds/dbcluster/setup.go +++ b/pkg/controller/rds/dbcluster/setup.go @@ -781,12 +781,6 @@ func (e *custom) postUpdate(ctx context.Context, cr *svcapitypes.DBCluster, obj return upd, err } - if meta.WasDeleted(cr) { - // (schroeder-paul): if we are in the deleting state (which can take a while) we do not need to do - // any of the following, so we return here. - return upd, nil - } - desiredPassword, err := dbinstance.GetDesiredPassword(ctx, e.kube, cr) if err != nil { return upd, errors.Wrap(err, dbinstance.ErrRetrievePasswordForUpdate) diff --git a/pkg/controller/rds/dbcluster/zz_controller.go b/pkg/controller/rds/dbcluster/zz_controller.go index 57025e2e81..3982781272 100644 --- a/pkg/controller/rds/dbcluster/zz_controller.go +++ b/pkg/controller/rds/dbcluster/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDBCluster(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/rds/dbclusterparametergroup/zz_controller.go b/pkg/controller/rds/dbclusterparametergroup/zz_controller.go index 866253e5b0..036d0b4db2 100644 --- a/pkg/controller/rds/dbclusterparametergroup/zz_controller.go +++ b/pkg/controller/rds/dbclusterparametergroup/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDBClusterParameterGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/rds/dbinstance/setup.go b/pkg/controller/rds/dbinstance/setup.go index 4be2046a70..e6cde499ac 100644 --- a/pkg/controller/rds/dbinstance/setup.go +++ b/pkg/controller/rds/dbinstance/setup.go @@ -261,12 +261,6 @@ func (e *custom) postUpdate(ctx context.Context, cr *svcapitypes.DBInstance, out return upd, err } - if meta.WasDeleted(cr) { - // (schroeder-paul): if we are in the deleting state (which can take a while) we do not need to do - // any of the following, so we return here. - return upd, nil - } - desiredPassword, err := dbinstance.GetDesiredPassword(ctx, e.kube, cr) if err != nil { return upd, errors.Wrap(err, dbinstance.ErrRetrievePasswordForUpdate) diff --git a/pkg/controller/rds/dbinstance/zz_controller.go b/pkg/controller/rds/dbinstance/zz_controller.go index 4a4f1eb95a..f9b9b3aaf7 100644 --- a/pkg/controller/rds/dbinstance/zz_controller.go +++ b/pkg/controller/rds/dbinstance/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDBInstance(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/rds/dbparametergroup/zz_controller.go b/pkg/controller/rds/dbparametergroup/zz_controller.go index d0289dd861..f65b70afb4 100644 --- a/pkg/controller/rds/dbparametergroup/zz_controller.go +++ b/pkg/controller/rds/dbparametergroup/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateDBParameterGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/rds/globalcluster/zz_controller.go b/pkg/controller/rds/globalcluster/zz_controller.go index 97b78a8ca9..8223e12742 100644 --- a/pkg/controller/rds/globalcluster/zz_controller.go +++ b/pkg/controller/rds/globalcluster/zz_controller.go @@ -92,15 +92,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateGlobalCluster(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/rds/optiongroup/zz_controller.go b/pkg/controller/rds/optiongroup/zz_controller.go index 8027587131..d9c5db5c71 100644 --- a/pkg/controller/rds/optiongroup/zz_controller.go +++ b/pkg/controller/rds/optiongroup/zz_controller.go @@ -93,15 +93,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateOptionGroup(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/route53resolver/resolverendpoint/zz_controller.go b/pkg/controller/route53resolver/resolverendpoint/zz_controller.go index 718b2dfadc..181cc9f683 100644 --- a/pkg/controller/route53resolver/resolverendpoint/zz_controller.go +++ b/pkg/controller/route53resolver/resolverendpoint/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateResolverEndpoint(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/route53resolver/resolverrule/zz_controller.go b/pkg/controller/route53resolver/resolverrule/zz_controller.go index 4e4c55e43c..5598dd64fa 100644 --- a/pkg/controller/route53resolver/resolverrule/zz_controller.go +++ b/pkg/controller/route53resolver/resolverrule/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateResolverRule(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/s3control/accesspoint/zz_controller.go b/pkg/controller/s3control/accesspoint/zz_controller.go index 262cb67e48..51ca433722 100644 --- a/pkg/controller/s3control/accesspoint/zz_controller.go +++ b/pkg/controller/s3control/accesspoint/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateAccessPoint(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/secretsmanager/secret/setup.go b/pkg/controller/secretsmanager/secret/setup.go index a5de6ac0db..b64273f52f 100644 --- a/pkg/controller/secretsmanager/secret/setup.go +++ b/pkg/controller/secretsmanager/secret/setup.go @@ -237,10 +237,6 @@ func getAWSSecretData(ref *svcapitypes.SecretReference, s *svcsdk.GetSecretValue } func (e *hooks) isUpToDate(ctx context.Context, cr *svcapitypes.Secret, resp *svcsdk.DescribeSecretOutput) (bool, string, error) { - if meta.WasDeleted(cr) { - return false, "", nil - } - // NOTE(muvaf): No operation can be done on secrets that are marked for deletion. if resp.DeletedDate != nil { return true, "", nil diff --git a/pkg/controller/secretsmanager/secret/zz_controller.go b/pkg/controller/secretsmanager/secret/zz_controller.go index 78a9acde99..33185922ac 100644 --- a/pkg/controller/secretsmanager/secret/zz_controller.go +++ b/pkg/controller/secretsmanager/secret/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateSecret(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/servicecatalog/provisionedproduct/zz_controller.go b/pkg/controller/servicecatalog/provisionedproduct/zz_controller.go index 0326d862ff..b6199462d5 100644 --- a/pkg/controller/servicecatalog/provisionedproduct/zz_controller.go +++ b/pkg/controller/servicecatalog/provisionedproduct/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateProvisionedProduct(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/servicediscovery/service/zz_controller.go b/pkg/controller/servicediscovery/service/zz_controller.go index ef59f6dfdd..2075395a0b 100644 --- a/pkg/controller/servicediscovery/service/zz_controller.go +++ b/pkg/controller/servicediscovery/service/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateService(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/sesv2/configurationset/setup.go b/pkg/controller/sesv2/configurationset/setup.go index daf039aa18..cf9f26c5b0 100644 --- a/pkg/controller/sesv2/configurationset/setup.go +++ b/pkg/controller/sesv2/configurationset/setup.go @@ -77,10 +77,6 @@ type hooks struct { } func isUpToDate(_ context.Context, cr *svcapitypes.ConfigurationSet, resp *svcsdk.GetConfigurationSetOutput) (bool, string, error) { - if meta.WasDeleted(cr) { - return true, "", nil // There is no need to check for updates when we want to delete. - } - if !isUpToDateDeliveryOptions(cr, resp) { return false, "", nil } diff --git a/pkg/controller/sesv2/configurationset/zz_controller.go b/pkg/controller/sesv2/configurationset/zz_controller.go index 5c47e7f102..75ac4eb540 100644 --- a/pkg/controller/sesv2/configurationset/zz_controller.go +++ b/pkg/controller/sesv2/configurationset/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateConfigurationSet(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/sesv2/emailidentity/setup.go b/pkg/controller/sesv2/emailidentity/setup.go index 83568244f2..890105f792 100644 --- a/pkg/controller/sesv2/emailidentity/setup.go +++ b/pkg/controller/sesv2/emailidentity/setup.go @@ -25,7 +25,6 @@ import ( xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/event" - "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" "github.com/pkg/errors" @@ -81,10 +80,6 @@ type hooks struct { } func (e *hooks) isUpToDate(_ context.Context, cr *svcapitypes.EmailIdentity, resp *svcsdk.GetEmailIdentityOutput) (bool, string, error) { //nolint:gocyclo - if meta.WasDeleted(cr) { - return true, "", nil // There is no need to check for updates when we want to delete. - } - if pointer.StringValue(cr.Spec.ForProvider.ConfigurationSetName) != pointer.StringValue(resp.ConfigurationSetName) { return false, "", nil } diff --git a/pkg/controller/sesv2/emailidentity/zz_controller.go b/pkg/controller/sesv2/emailidentity/zz_controller.go index 05e813ea35..51e9aaeb47 100644 --- a/pkg/controller/sesv2/emailidentity/zz_controller.go +++ b/pkg/controller/sesv2/emailidentity/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateEmailIdentity(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/sesv2/emailtemplate/setup.go b/pkg/controller/sesv2/emailtemplate/setup.go index ff41415889..826f590128 100644 --- a/pkg/controller/sesv2/emailtemplate/setup.go +++ b/pkg/controller/sesv2/emailtemplate/setup.go @@ -62,10 +62,6 @@ func SetupEmailTemplate(mgr ctrl.Manager, o controller.Options) error { } func isUpToDate(_ context.Context, cr *svcapitypes.EmailTemplate, resp *svcsdk.GetEmailTemplateOutput) (bool, string, error) { - if meta.WasDeleted(cr) { - return true, "", nil // There is no need to check for updates when we want to delete. - } - if cr.Spec.ForProvider.TemplateContent != nil && resp.TemplateContent != nil { if pointer.StringValue(cr.Spec.ForProvider.TemplateContent.HTML) != pointer.StringValue(resp.TemplateContent.Html) { return false, "", nil diff --git a/pkg/controller/sesv2/emailtemplate/zz_controller.go b/pkg/controller/sesv2/emailtemplate/zz_controller.go index 6e9521f3ad..7dc58e1f92 100644 --- a/pkg/controller/sesv2/emailtemplate/zz_controller.go +++ b/pkg/controller/sesv2/emailtemplate/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateEmailTemplate(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/sfn/activity/zz_controller.go b/pkg/controller/sfn/activity/zz_controller.go index 78b5796cd8..f477244ca1 100644 --- a/pkg/controller/sfn/activity/zz_controller.go +++ b/pkg/controller/sfn/activity/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateActivity(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/sfn/statemachine/zz_controller.go b/pkg/controller/sfn/statemachine/zz_controller.go index 33840a5861..11c4dad43f 100644 --- a/pkg/controller/sfn/statemachine/zz_controller.go +++ b/pkg/controller/sfn/statemachine/zz_controller.go @@ -89,15 +89,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateStateMachine(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/transfer/server/zz_controller.go b/pkg/controller/transfer/server/zz_controller.go index 42ec56f8ca..b2b74fe452 100644 --- a/pkg/controller/transfer/server/zz_controller.go +++ b/pkg/controller/transfer/server/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateServer(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/transfer/user/zz_controller.go b/pkg/controller/transfer/user/zz_controller.go index 7589dd85cd..41f026aa27 100644 --- a/pkg/controller/transfer/user/zz_controller.go +++ b/pkg/controller/transfer/user/zz_controller.go @@ -88,15 +88,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } GenerateUser(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true, diff --git a/templates/crossplane/pkg/controller.go.tpl b/templates/crossplane/pkg/controller.go.tpl index a772c97e24..e3048c69aa 100644 --- a/templates/crossplane/pkg/controller.go.tpl +++ b/templates/crossplane/pkg/controller.go.tpl @@ -104,15 +104,13 @@ func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed. return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") } Generate{{ .CRD.Names.Camel }}(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) - if meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted - return managed.ExternalObservation{ - ResourceExists: true, - ResourceUpToDate: true, - }, nil - } - upToDate, diff, err := e.isUpToDate(ctx, cr, resp) - if err != nil { - return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + upToDate := true + diff := "" + if !meta.WasDeleted(cr) { // There is no need to run isUpToDate if the resource is deleted + upToDate, diff, err = e.isUpToDate(ctx, cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } } return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ ResourceExists: true,