我正在尝试使用 terraform VCD 提供程序在 vmware vclouddirector 10 中创建虚拟机。
版本
terraform {
required_providers {
vcd = {
source = "vmware/vcd"
version = "3.0.0"
}
}
}
主要代码:
resource "vcd_vapp" "vms" {
name = "apatsev-vapp"
power_on = "true"
}
resource "vcd_vapp_vm" "vm1" {
vapp_name = "apatsev_vm"
name = "apatsev1"
catalog_name = "CentOS"
template_name = "CentOS7_64-bit"
memory = 2048
cpus = 2
cpu_cores = 1
depends_on = [vcd_vapp.vms]
}
错误:
Error: error finding vApp: [ENF] entity not found
on main.tf line 28, in resource "vcd_vapp_vm" "vm1":
28: resource "vcd_vapp_vm" "vm1" {
如何修复错误?
答案1
工作代码:
resource "vcd_vapp" "vms" {
name = "apatsev-vapp"
power_on = "true"
}
resource "vcd_vapp_vm" "vm1" {
vapp_name = vcd_vapp.vms.name
name = "apatsev1"
catalog_name = "CentOS"
template_name = "CentOS7_64-bit"
memory = 2048
cpus = 2
cpu_cores = 1
depends_on = [vcd_vapp.vms]
}