integrations / integrations/terraform-provider-github

Add provider option to wait until primary rate limit reset before retrying requests (opt-in)

Open
#3,565 4 comments 0 reactions 0 assignees View on GitHub
Status: Blocked Status: Triage
Dominant language
Go
Stars
1.2k
Forks
1k
Avg merge
1d 14h
Merged PRs (30d)
8

Description

### Summary

Add an optional provider configuration to allow the Terraform GitHub provider to block (wait) until the GitHub primary rate limit reset time when a token-based request hits the primary rate limit. This would be disabled by default and opt-in to avoid surprising blocking behavior.

### Motivation

When using personal access tokens or other token-based auth the provider can hit GitHub's primary rate limit (hourly 5000 limit). In many use-cases (ad-hoc runs, interactive retries, small infra changes) it is preferable for the provider to wait until the reset time and then retry the request instead of immediately failing. However, this behavior should be opt-in to avoid blocking CI/CD pipelines unexpectedly.

### Current Behaviour

The provider fails with the following error when primary rate limit is hit (hourly 5000 token limit)

```bash
10: resource "github_team_repository" "team_repo_assignment" {
Error: failed to retrieve repository example-repo: Get "https://api.github.com/repos/example-org/example-repo": (http.RoundTripper).RoundTrip failed: primary rate limit reached on request to https://api.github.com/repos/example-org/example-repo with category: core. wait until 2026-07-21 05:21:38 +0000 UTC before sending more requests.
```

### Expected Behaviour

If the "opt in" flag is set to `true` the provider should block until the rate limit reset time.

### Naming suggestion for the flag

```terraform
provider "github" {
wait_for_primary_rate_limit = true
}
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the provider configuration handling and the request retry or primary-rate-limit error path; the issue does not name specific files or tests. Verify that the new option waits until the reported reset time before retrying when enabled, while the default remains non-blocking and preserves the current failure behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, go, terraform
Domain
api, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.