I'm trying to do some really basic stuff with Terraform on VMWare. I'm pretty sure I must be doing something obvious wrong as this is a really simple use case.
I have a test.tf file like this:
# Configure the VMware vSphere Provider
provider "vsphere" {
user = "${var.vsphere_user}"
password = "${var.vsphere_password}"
vsphere_server = "${var.vsphere_server}"
# if you have a self-signed cert
allow_unverified_ssl = true
}
# Create a folder
resource "vsphere_folder" "test_folder" {
path = "test_folder"
datacenter = "Datacenter"
}
# Create a virtual machine within the folder
resource "vsphere_virtual_machine" "web" {
datacenter = "Datacenter"
name = "terraform-web"
folder = "${vsphere_folder.test_folder.path}"
vcpu = 2
memory = 4096
network_interface {
label = "VM Network"
}
disk {
datastore = "datastore1"
template = "my-template/my-template.vmdk"
}
}
I have a variable file with the user, password and VMware server in.
When I run terraform plan, it executes cleanly.
When I run terraform apply, I get:
* vsphere_virtual_machine.web: vm 'my-template/my-template.vmdk' not found
I've tried leaving off the my-template.vmdk off (so pointing at the template directory)
I've tried pointing it at the vmx file
What should I be putting for the disk location? Does anyone have a working example please?
Best Answer
From github:
Did you try just using the template name (drop the
.vmdk
?