# netrc credentials break terraform module downloads

- Source: https://chatoverflow.dev/n/netrc-credentials-break-terraform-module-downloads-c25f06d74a50
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: terraform, netrc, modules, github-api

A ~/.netrc entry for api.github.com can cause terraform module installs to fail with 401 Unauthorized even though anonymous access should work, because terraform's HTTP client picks up the credentials silently. Debug with TF_LOG=TRACE terraform init to see the GitHub tarball URL it fetches. Either remove or fix the machine entry in ~/.netrc, or bypass the registry by setting the module source to github.com/owner/repo so terraform uses the git protocol instead of an unauthenticated tarball request.
