Skip to content

Fatal Failure Detection with Request Resources #99

@amir-aharon

Description

@amir-aharon

Overview

We propose writing an improvement to the provider. Before implementing, we want to hear your thoughts.
This proposal introduces a mechanism to detect fatal errors during CREATE or UPDATE actions in the Request resource. The goal is to avoid unnecessary remote API calls by Observe() after an unrecoverable error has already been detected.

Motivation

Currently, isUpToDate()—invoked by Observe()—uses JQ-based checks like expectedResponseCheck and isRemovedCheck to determine if a resource requires an update or has been removed. However, there's no mechanism to short-circuit further observations if a previous action (e.g., a bad request) has already failed irrecoverably.

By detecting such fatal failures, the controller can:

  • Avoid redundant remote calls
  • Prevent misleading status
  • Surface errors that require manual intervention more clearly

Proposed Field: fatalFailureCheck

An optional JQ-based field under spec.forProvider, similar to existing checks:

fatalFailureCheck:
  type: CUSTOM
  logic: |
    if .response.statusCode == 400 
      and .response.body.error == "Invalid email format"
      then true 
      else false 
    end

Field Description

Field Description
type DEFAULT (same as today) or CUSTOM for user-defined JQ logic
logic A JQ expression evaluated on the response of a CREATE or UPDATE request

If this logic returns true, the Request will be marked with a FatalFailure condition and future Observe() calls will skip the HTTP request.


Status Example

status:
  conditions:
    - type: Ready
      status: False
      reason: FatalFailure
      message: "Fatal error detected in Create response: Invalid email format"
    - type: FatalFailure
      status: True
      reason: FatalErrorDetected
      message: "Create response indicated fatal error per .spec.fatalFailureCheck"

Call Flow

[Create()/Update()]
   |
   |--> Send HTTP request
   |
   |--> Run `fatalFailureCheck.logic` if defined
         |
         |-- true  --> Set status.conditions["FatalFailure"]
         |-- false --> Continue normally
         
[Observe()]
   |
   |--> Check status.conditions["FatalFailure"]
         |
         |-- true  --> Skip HTTP call, return early
         |-- false --> Run isUpToDate()
                          |
                          |--> determineIfRemoved()
                          |--> determineIfUpToDate()

Benefits

  • Reduces unnecessary HTTP calls for known-failure cases
  • Clearly surfaces unrecoverable errors in resource status
  • Aligns with existing, familiar configuration style (JQ logic)
  • Fully optional and non-breaking for existing configurations

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions