terraform
install_error
ai_generated
partial
Error: Failed to download module: could not download module "my_module" (main.tf:1) source code from "git::https://github.com/myorg/terraform-modules.git//networking?ref=v1.0": error downloading 'https://github.com/myorg/terraform-modules.git': git clone failed: remote: Repository not found.
ID: terraform/module-source-not-found-git
80%Fix Rate
85%Confidence
1Evidence
2023-07-22First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Terraform v1.5 | active | — | — | — |
| Terraform v1.6 | active | — | — | — |
| Terraform v1.7 | active | — | — | — |
| Git v2.30+ | active | — | — | — |
Root Cause
The Git repository specified in the module source does not exist, is private without proper authentication, or the URL is incorrect (e.g., typo, wrong org name).
generic中文
模块源中指定的 Git 仓库不存在、是私有的且没有正确认证,或者 URL 不正确(例如拼写错误、错误的组织名称)。
Official Documentation
https://developer.hashicorp.com/terraform/language/modules/sources#gitWorkarounds
-
85% success Verify the repository URL is correct by manually cloning it: 'git clone https://github.com/myorg/terraform-modules.git'. If it fails, check for typos or access permissions. For private repos, use a personal access token: 'git clone https://<token>@github.com/myorg/terraform-modules.git' or configure git credentials. Then run 'terraform init' again.
Verify the repository URL is correct by manually cloning it: 'git clone https://github.com/myorg/terraform-modules.git'. If it fails, check for typos or access permissions. For private repos, use a personal access token: 'git clone https://<token>@github.com/myorg/terraform-modules.git' or configure git credentials. Then run 'terraform init' again.
-
75% success If the repo is private, set up Git credentials via environment variable: 'export GIT_TERMINAL_PROMPT=0' and 'export GIT_ASKPASS=/path/to/helper' or use SSH authentication. Example: 'export GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=accept-new"' then 'terraform init'.
If the repo is private, set up Git credentials via environment variable: 'export GIT_TERMINAL_PROMPT=0' and 'export GIT_ASKPASS=/path/to/helper' or use SSH authentication. Example: 'export GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=accept-new"' then 'terraform init'.
中文步骤
Verify the repository URL is correct by manually cloning it: 'git clone https://github.com/myorg/terraform-modules.git'. If it fails, check for typos or access permissions. For private repos, use a personal access token: 'git clone https://<token>@github.com/myorg/terraform-modules.git' or configure git credentials. Then run 'terraform init' again.
If the repo is private, set up Git credentials via environment variable: 'export GIT_TERMINAL_PROMPT=0' and 'export GIT_ASKPASS=/path/to/helper' or use SSH authentication. Example: 'export GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=accept-new"' then 'terraform init'.
Dead Ends
Common approaches that don't work:
-
90% fail
In non-interactive CI/CD environments, there is no terminal for password input. Also, Git credentials should be configured via SSH keys or tokens, not interactive prompts.
-
85% fail
SSH access requires proper SSH keys configured in the environment. Without keys, SSH also fails with 'Permission denied'.
-
95% fail
The -from-module flag is for migrating state, not for fixing module download errors. It does not affect source URL resolution.