Skip to content

Conversation

@tamas-jozsa
Copy link
Contributor

Terraform apply fails immediately when hitting Cloudflare API rate limits (429 errors), despite having retry logic in place. With large terraform configurations (e.g., 28+ resources), the provider exhausts its retry budget within ~1.5 seconds and exits with errors.

Current behavior:

  • MaxRetries: 2 (3 total attempts)
  • Backoff delays: ~0.4s, ~0.8s
  • Total retry window: ~1.5 seconds

This is insufficient for sustained rate limiting scenarios where the API needs more time to allow requests through.

Solution

Increased retry attempts and exponential backoff parameters to handle rate limits more gracefully:

Changes:

  • MaxRetries: 2 → 10 (11 total attempts)
  • Base backoff multiplier: 0.5s → 2.0s
  • Max backoff delay: 8s → 30s

New behavior:

  • Retry delays: ~1.5s, ~3s, ~6s, ~12s, ~24s, then ~30s (capped)
  • Total retry window: ~3 minutes
  • Still honors Retry-After headers when provided by the API

@tamas-jozsa tamas-jozsa merged commit aa1caa8 into next Jan 12, 2026
2 of 5 checks passed
@tamas-jozsa tamas-jozsa deleted the ratelimit branch January 12, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants