在 Mac OS 上通过 brew 安装 terraform v1.0.3
这是我第一次将 Terraform 与“vshpere”提供程序一起使用。当我在我的计划中执行 terraform init
时,我收到以下错误。
provider "vsphere" {
user = var.vsphere_user
password = var.vsphere_password
vsphere_server = var.vsphere_server
}
module "exa_v30_01" {
source = "../modules/vm"
vsphere_user = var.vsphere_user
vsphere_password = var.vsphere_password
template_name = var.template_name
vm_name = var.vm_name
}
$ terraform init
Initializing modules...
Initializing the backend...
Initializing provider plugins...
- Finding latest version of hashicorp/vsphere...
- Finding latest version of hashicorp/vmsphere...
- Installing hashicorp/vsphere v2.0.2...
- Installed hashicorp/vsphere v2.0.2 (signed by HashiCorp)
╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider
│ hashicorp/vmsphere: provider registry registry.terraform.io does
│ not have a provider named registry.terraform.io/hashicorp/vmsphere
│
│ All modules should specify their required_providers so that
│ external consumers will get the correct providers when using a
│ module. To see which modules are currently depending on
│ hashicorp/vmsphere, run the following command:
│ terraform providers
╵
$ terraform providers
Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/vsphere]
└── module.exa_v30_01
├── provider[registry.terraform.io/hashicorp/vsphere]
└── provider[registry.terraform.io/hashicorp/vmsphere]
我该如何解决这个问题?我在这里搜索并搜索,但没有与 VSphpere 相关的内容。有什么线索吗?谢谢
更新:
我看到 Force Terraform to install providers from local disk only, disabling Terraform Registry,但这是 terraform 版本升级。
答案 0 :(得分:1)
错误信息是正确的。有一个名为 vmsphere
的没有提供者。也许您想要 vsphere 提供商?您的模块 exa_v30_01
似乎在某处使用了错误的提供程序。