feat: Add proactive rate limiting implementation #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements proactive rate limiting for the Auth0 Terraform Provider, mirroring the approach used in the Okta Terraform Provider. The implementation provides intelligent throttling to prevent hitting Auth0 API rate limits by monitoring usage and proactively sleeping when approaching capacity thresholds.
Key Features
max_api_capacityparameter (1-100%) with environment variable supportx-ratelimit-*headers and rate limit policyConfiguration
Or via environment variable:
export AUTH0_MAX_API_CAPACITY=70Implementation Details
internal/ratelimit): Tracks API usage per endpoint and bucketinternal/transport): HTTP transport wrapper with throttling logicPerformance Impact
Test Plan
Testing Commands
Manual Testing
The implementation can be tested by:
max_api_capacityto a low value (e.g., 10%)This implementation follows Auth0's rate limit policy documentation and provides a robust foundation for preventing API limit violations in large-scale Terraform deployments.