terraform-linters / tflint

A Pluggable Terraform Linter
Mozilla Public License 2.0
4.97k stars 357 forks source link

Add support for Github auth token via environment variable #1988

Closed dgibbard-cisco closed 9 months ago

dgibbard-cisco commented 9 months ago

Introduction

Hoping I haven't missed this in the docs, but we're getting rate limited by Github, when running tflint --init which is trying to pull (for example) the AWS plugin.

Example Output:

Installing "aws" plugin...
Failed to install a plugin; Failed to fetch GitHub releases: GET https://api.github.com/repos/terraform-linters/tflint-ruleset-aws/releases/tags/v0.30.0: 403 API rate limit exceeded for 146.112.163.42. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.) [rate reset in 43m44s]

Proposal

add support for GITHUB_API_TOKEN or similar to allow users to provide authentication tokens for github to reduce impact of anonymous rate limiting.

Support is supported in the go-github module: in the WithAuthToken method: https://github.com/google/go-github#authentication

References

N/A

bendrucker commented 9 months ago

GITHUB_TOKEN:

https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting