terraform module_error ai_generated true

Error: Module not found: module "vpc" source "terraform-aws-modules/vpc/aws" not found in registry

ID: terraform/module-source-not-found

Also available as: JSON · Markdown · 中文
85%Fix Rate
86%Confidence
1Evidence
2024-04-18First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Terraform v1.5.0 active — — —
Terraform v1.6.0 active — — —
Terraform v1.7.0 active — — —

Root Cause

The specified module source does not exist in the Terraform registry or the version constraint does not match any published version.

generic

中文

指定的模块源在Terraform注册表中不存在,或版本约束与任何已发布版本不匹配。

Official Documentation

https://developer.hashicorp.com/terraform/language/modules/sources

Workarounds

  1. 85% success Verify the module name and namespace in the Terraform registry: `terraform-aws-modules/vpc/aws` is correct; check for typos. Then run 'terraform init'.
    Verify the module name and namespace in the Terraform registry: `terraform-aws-modules/vpc/aws` is correct; check for typos. Then run 'terraform init'.
  2. 90% success If the module is private, add a module source with a Git URL: `source = "git::https://github.com/org/terraform-aws-vpc.git?ref=v3.0.0"` and run 'terraform init'
    If the module is private, add a module source with a Git URL: `source = "git::https://github.com/org/terraform-aws-vpc.git?ref=v3.0.0"` and run 'terraform init'

中文步骤

  1. Verify the module name and namespace in the Terraform registry: `terraform-aws-modules/vpc/aws` is correct; check for typos. Then run 'terraform init'.
  2. If the module is private, add a module source with a Git URL: `source = "git::https://github.com/org/terraform-aws-vpc.git?ref=v3.0.0"` and run 'terraform init'

Dead Ends

Common approaches that don't work:

  1. Run 'terraform init' without any flags 95% fail

    Init can only install modules if the source is valid; it won't fix a non-existent source.

  2. Use a local file path instead of the registry source 80% fail

    The local path must contain the module; a random path won't work.

  3. Add a version constraint like 'version = "latest"' 90% fail

    The module doesn't exist at all; no version constraint can fix that.