Skip to content

Fast failure option for ArgoCD Applications upon failed sync #808

@Matt5981

Description

@Matt5981

Description

Presently, when the wait flag is set on an argocd_application resource with auto-sync enabled, the provider returns a RetryableError if the application is not healthy, or if the status is not synced.

It does not check the phase of the application. As such, if the sync fails, the application's health and sync status may never become healthy and synced, and Terraform will continue retrying until the timeout period elapses. The result in this case is still an eventual failure, but in some circumstances it may be desirable for this to occur immediately rather then once the timeout period elapses.

A potential solution is adding a property failed_phase_retry_limit to the argocd_application resource that enables checking the application phase. If it enters a failure state (e.g., Error or Failed) with the wait flag also set, the provider will return a RetryableError the defined number of times before returning a NonRetryableError. This would default to infinite, as well as remain infinite if the option is set to a negative integer or null, to avoid breaking existing behavior.

Potential Terraform Configuration

resource "argocd_application" "application" {
  metadata {
    name = "application"
    namespace = "argocd"
  }

  spec {
    destination {
      server = "https://kubernetes.default.svc"
      namespace = "default"
    }

    source {
      # ...
    }
  }
  # ...
  wait = true
  failed_phase_retry_limit = 5  # Fail in Terraform after 5 retries with the phase at a failure state
}

References

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions