The Issue
When using Terraform to deploy a virtual machine OVA using Terraform, I kept hitting the below error:
Error: error while creating vapp properties config unsupported vApp properties in vapp.properties: [vm.vmname vami.gateway.DMS_agent_VA vami.netmask0.DMS_Agent_VA vami.DNS.DMS_Agent_VA vami.searchpath.DMS_Agent_VA vami.ip0.DMS_Agent_VA vami.domain.DMS_Agent_VA] on Agent_appliance/main.tf line 20, in resource "vsphere_virtual_machine" "vm": 20: resource "vsphere_virtual_machine" "vm"
Pretty simple right? In my Terraform file I was trying to use OVF Properties that were not valid. Getting the debug/trace logs from terraform also just showed the same error output.
However running ovftool, confirmed my properties were correct. (shortened output example).
ClassId: vami Key: searchpath InstanceId DMS_Agent_VA Category: Networking Properties Label: Domain Search Path Type: string Description: The domain search path (comma or space separated domain names) for this VM. Leave blank if DHCP is desired.
But also in the vCenter UI, looking at the vApp Properties of a the OVA once deployed, again I could validate the the properties I was using were correct.
Finally an example of the vSphere_virtual_machine resource I was trying to deploy that was causing me issues:
resource "vsphere_virtual_machine" "vm" { name = "${var.agent_vm_name}" resource_pool_id = "${var.resource_pool_id}" datastore_id = "${data.vsphere_datastore.datastore.id}" folder = "${var.folder}" wait_for_guest_net_timeout = 0 wait_for_guest_ip_timeout = 0 datacenter_id = "${data.vsphere_datacenter.dc.id}" host_system_id = "${data.vsphere_host.host.id}" dynamic "ovf_deploy" { for_each = "${var.agent_local_ovf_path}" != "" || "${var.agent_remote_ovf_path}" != "" ? [0] : [] content { // Path to local or remote ovf/ova file local_ovf_path = "${var.agent_local_ovf_path}" != "" ? "${var.agent_local_ovf_path}" : null remote_ovf_url = "${var.agent_remote_ovf_path}" != "" ? "${var.agent_remote_ovf_path}" : null disk_provisioning = "thin" ovf_network_map = { "Control Plane Network" = data.vsphere_network.network.id } } } vapp { properties = { "vm.vmname" = "${var.agent_vm_name}", "varoot_password" = "${var.varoot_password}", "vaadmin_password" = "${var.va_admin_password}", "guestinfo.cis.appliance.net.ntp" = "${var.ntp}", "vami.gateway.DMS_agent_VA" = "${var.controlplanenetworkgateway}", "vami.DNS.DMS_Agent_VA" = "${var.dns}", "vami.domain.DMS_Agent_VA" = "${var.domain}", "vami.searchpath.DMS_Agent_VA" = "${var.searchpath}", "vami.ip0.DMS_Agent_VA" = "${var.agentip0}", "vami.netmask0.DMS_Agent_VA" = "${var.agentip0netmask}" } } }
The Cause
Yep, you guessed it, there was something wrong with the properties I was trying to configure.
The Fix
Continue reading Terraform vSphere Provider – Error while creating vApp properties