【发布时间】:2021-11-23 19:15:16
【问题描述】:
我正在尝试使用 terraform 在 Vcloud 中自动部署 VM。 我使用的服务器没有互联网连接,所以我必须离线安装 terraform 和 VCD 提供程序。 Terrafom init 有效,但是当我使用 terraform 计划时崩溃了...... 地形版本:1.0.11 VCD 提供者版本:3.2.0(我使用这个版本是因为我们有 vcloud 9.7)。 这是一个测试脚本,看看 terraform 是否有效
terraform {
required_providers {
vcd = {
source = "vmware/vcd"
version = "3.2.0"
}
}
}
provider "vcd" {
user = "test"
password = "test"
url = "https://test/api"
auth_type = "integrated"
vdc = "Org1VDC"
org = "System"
max_retry_timeout = "60"
allow_unverified_ssl = "true"
}
resource "vcd_org_user" "my-org-admin" {
org = "my-org"
name = "my-org-admin"
description = "a new org admin"
role = "Organization Administrator"
password = "change-me"
}
当我运行 terraform plan 时,出现以下错误:
Error: Plugin did not respond
...
The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ConfigureProvider call. The plugin logs may contain more details
Stack trace from the terraform-provider-vcd_v3.2.0 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xaf3b75]
...
Error: The terraform-provider-vcd_v3.2.0 plugin crashed!
在日志中,我可以看到提供者尝试连接到 github 的大量 DEBUG 消息。 provider.terraform-provider-vcd_v3.2.0:github.com/vmware/go-vcloud-director/v2/govcd.(*VCDClient).Authenticate(...) 而对于错误消息,我只看到了 2:
- plugin.(*GRPCProvider).ConfigureProvider: error="rpc error: code = Unavailable desc = transport is closing"
- 无法读取插件锁定文件 .terraform/plugins/linux_amd64/lock.json:打开 .terraform/plugins/linux_amd64/lock.json:没有这样的文件或目录
这是我第一次离线配置 Terraform 并使用 VCD 提供程序。 我错过了什么吗?
【问题讨论】:
-
这显然是提供程序中的一个错误。也许这是提供者的错误处理代码中的一个错误(但这是一个猜测)。
-
可能是这样,但我尝试了 3.1.0 并且得到了相同的结果...可能是 VCloud 或 API 链接有问题...
标签: terraform vcloud-director-rest-api