Terraform "Module not found" in a private registry in CI
Terraform queried a private module registry and it returned not found. Either the namespace/name/provider address is wrong, or the credentials the runner sent do not grant visibility to that module.
What this error means
terraform init stops with "Error: Module not found" or a 404 from the module registry for a host/namespace/name/provider source.
Error: Failed to retrieve available versions for module "network"
Could not retrieve the list of available versions for module network from
app.terraform.io: module "app.terraform.io/acme/network/aws" not found.Common causes
A wrong module address
The namespace/name/provider (or host prefix) is misspelled, so the private registry has no matching module.
The token cannot see the module
The credentials are valid but scoped to a different organization, so the module is effectively not found for this token.
How to fix it
Confirm the exact private module address
- Open the module in the private registry and copy its exact source string.
- Match the host, namespace, name, and provider in the module block.
- Re-run init to confirm the module resolves.
module "network" {
source = "app.terraform.io/acme/network/aws"
version = "~> 1.2"
}Use a token scoped to the module org
Set a TF_TOKEN_<host> credential for a principal that can read the module.
env:
TF_TOKEN_app_terraform_io: ${{ secrets.TFC_TOKEN }}How to prevent it
- Copy private module addresses directly from the registry.
- Scope registry tokens to the org that owns the module.
- Pin a
versionso a real release is requested.