terraform module_error ai_generated true

Error: Failed to download module: module "vpc" (path: modules/vpc) source "github.com/terraform-aws-modules/terraform-aws-vpc?ref=v5.0.0" is not a valid module source

ID: terraform/terraform-module-source-invalid

Also available as: JSON · Markdown · 中文
95%Fix Rate
90%Confidence
1Evidence
2023-09-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Terraform v1.5 active
Terraform v1.6 active
Terraform v1.7 active

Root Cause

The module source address uses an unsupported format or has a typo, such as missing the 'git::' prefix for Git repositories.

generic

中文

模块源地址使用了不支持的格式或存在拼写错误,例如 Git 仓库缺少 'git::' 前缀。

Official Documentation

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

Workarounds

  1. 95% success Use the correct Git source format: 'git::https://github.com/terraform-aws-modules/terraform-aws-vpc.git?ref=v5.0.0'.
    Use the correct Git source format: 'git::https://github.com/terraform-aws-modules/terraform-aws-vpc.git?ref=v5.0.0'.
  2. 90% success Use the Terraform Registry address: 'terraform-aws-modules/vpc/aws' with version constraint.
    Use the Terraform Registry address: 'terraform-aws-modules/vpc/aws' with version constraint.

中文步骤

  1. Use the correct Git source format: 'git::https://github.com/terraform-aws-modules/terraform-aws-vpc.git?ref=v5.0.0'.
  2. Use the Terraform Registry address: 'terraform-aws-modules/vpc/aws' with version constraint.

Dead Ends

Common approaches that don't work:

  1. 80% fail

    Terraform requires explicit scheme prefixes for non-HTTP sources; GitHub URLs without 'git::' are treated as HTTP, which fails.

  2. 70% fail

    Terraform expects a full URL with scheme; omitting 'https://' leads to an invalid source error.

  3. 90% fail

    Relative paths only work for local modules; remote modules require a full URL or registry address.