Hello,
I have been able to successfully build VMs based on templates for a while. Recently, we changed the authentication of vCenter to use LDAP. Since then, when running terraform apply, I’m not getting the message below. Any ideas?
{
“type”: “com.vmware.vapi.std.errors.invalid_argument”,
“value”: {
“error_type”: “INVALID_ARGUMENT”,
“messages”: [
{
“args”: [
“messages”,
“com.vmware.vapi.std.errors.unauthenticated”
],
“default_message”: “Could not convert field ‘messages’ of structure ‘com.vmware.vapi.std.errors.unauthenticated’”,
“id”: “vapi.bindings.typeconverter.tovalue.struct.field.error”
},
{
“args”: [
“args”,
“com.vmware.vapi.std.localizable_message”
],
“default_message”: “Required field ‘args’ of structure ‘com.vmware.vapi.std.localizable_message’ is missing”,
“id”: “vapi.bindings.typeconverter.tovalue.struct.field.missing”
}
]
}
}
I have attached my instance resource below if that helps. Thanks!!
resource “vsphere_virtual_machine” “vm” {
name = var.virtual_machine_name
resource_pool_id = data.vsphere_resource_pool.pool.id
datastore_id = data.vsphere_datastore.datastore.id
num_cpus = 2
memory = 4096
guest_id = var.guest_id
network_interface {
network_id = data.vsphere_network.network.id
# Static Mac added for testing purposes. If a new project, remove this setting.
#mac_address = "00:50:56:80:9d:7f"
mac_address = var.instance_mac
}
disk {
label = "disk0"
size = 40
thin_provisioned = true # This parameter must match the vm/template.
}
wait_for_guest_net_timeout = 0
wait_for_guest_ip_timeout = 0
clone {
template_uuid = "${data.vsphere_virtual_machine.template.id}"
customize {
linux_options {
host_name = var.virtual_machine_name
domain = "test.internal"
}
network_interface {
ipv4_address = var.ip_address
ipv4_netmask = 23
}
ipv4_gateway = "172.25.12.1"
}
}
provisioner “remote-exec” {
inline = [
"sudo apt -y update",
"sudo apt -y install nginx",
"sudo systemctl enable nginx",
"sudo systemctl start nginx",
"sudo apt -y upgrade"
]
connection {
type = "ssh"
host = var.ip_address
user = var.system_user
password = var.system_password
}
}
}