我想创建Terraform
模块,以便在VMware
中创建虚拟机,我必须使用模板:
定义基本相同,但是某些自定义因模板而异。是否可以在资源的同一定义中定义两个不兼容的部分,但是必须根据特定条件使用它们?
customize {
timeout = 40
windows_options {
count = "${var.os_type == "windows" ? 1 : 0 }"
computer_name = "${lower(var.envname)}${var.vm_name}"
organization_name = "Org"
join_domain = "${var.domain}"
domain_admin_user = "${var.domain_user}"
domain_admin_password = "${var.domain_password}"
admin_password = "${var.admin_password}"
auto_logon = "true"
run_once_command_list = "${var.run_once}"
}
linux_options {
count = "${var.os_type == "windows" ? 0 : 1 }"
host_name = "${lower(var.envname)}${var.vm_name}"
domain = "${var.domain}"
}
}
vsphere_virtual_machine.vm:“克隆.0.customize.0.windows_options”: 与clone.0.customize.0.linux_options冲突
Terraform v0.11.14