terraform module_error ai_generated true

错误:下载模块失败:模块 "vpc"(路径:modules/vpc)源 "github.com/terraform-aws-modules/terraform-aws-vpc?ref=v5.0.0" 不是有效的模块源

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

其他格式: JSON · Markdown 中文 · English
95%修复率
90%置信度
1证据数
2023-09-05首次发现

版本兼容性

版本状态引入弃用备注
Terraform v1.5 active
Terraform v1.6 active
Terraform v1.7 active

根因分析

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

English

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

generic

官方文档

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

解决方案

  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.

无效尝试

常见但无效的做法:

  1. 80% 失败

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

  2. 70% 失败

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

  3. 90% 失败

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