【问题标题】:Terraform Vcloud provider is crashing when using terraform planTerraform Vcloud 提供程序在使用 terraform plan 时崩溃
【发布时间】: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:

  1. plugin.(*GRPCProvider).ConfigureProvider: error="rpc error: code = Unavailable desc = transport is closing"
  2. 无法读取插件锁定文件 .terraform/plugins/linux_amd64/lock.json:打开 .terraform/plugins/linux_amd64/lock.json:没有这样的文件或目录

这是我第一次离线配置 Terraform 并使用 VCD 提供程序。 我错过了什么吗?

【问题讨论】:

  • 这显然是提供程序中的一个错误。也许这是提供者的错误处理代码中的一个错误(但这是一个猜测)。
  • 可能是这样,但我尝试了 3.1.0 并且得到了相同的结果...可能是 VCloud 或 API 链接有问题...

标签: terraform vcloud-director-rest-api


【解决方案1】:

我找到了问题。 在 URL 处,我使用了 Vcloud api 的 IP 地址,由于某种原因 terraform 不喜欢这样并导致崩溃,在更改为 FQDN 后,terraform 再次开始工作。

亲切的问候

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-08-31
    • 2021-03-14
    • 1970-01-01
    • 2021-09-11
    • 2021-01-19
    • 2021-07-22
    • 2021-12-26
    相关资源
    最近更新 更多