tofu does not supply available credentials (for example from credentials.tfrc.json) to the http request attempting to download a provider package from a registry.
Community note
[!TIP] Hi there, OpenTofu community! The OpenTofu team prioritizes issues based on upvotes. Please make sure to upvote this issue and describe how it affects you in detail in the comments to show your support.
OpenTofu Version
main branch
1.12.2OpenTofu Configuration Files
.tofurc
provider_installation {
network_mirror {
url = "https://protected.custom.server/tofu/providers"
include = ["registry.opentofu.org/*/*"]
}
}credentials.tfrc.json
{
"credentials": {
"token": "SECRET"
}
}Debug Output
unsuccessful request to ... 401
Expected Behavior
The request that's supposed to download the provider using supplied credentials succeeds.
Actual Behavior
Requests to repository json files for providers such as index.json or $numversion.json (see https://opentofu.org/docs/internals/provider-registry-protocol/) succeed usign supplied credentials but the final request fails.
Steps to Reproduce
tofu init with a protected private registry and config files as described.
Additional Context
Code in https://github.com/veith4f/opentofu/tree/feature/include_credentials_in_getprovider_http_request fixes the issue. I am currently using it. See also. https://github.com/veith4f/opentofu/releases
References
No response
Source: opentofu/opentofu