Hi, I hope someone can help me with an issue I’m having.
I have a script to create a Windows VM with Terraform. When I try to launch the console for the VM I created, it says “Operating system not found.” Looking at the VM settings, the CD/DVD drive section has a checkbox checked for “Connect at power on.” This is supposed to connect the datastore ISO that I specified to the VM, but the ISO is not connected. I have to manually connect it and reboot the VM for it to work. We’ve built VMs through Power CLI before and did not have this problem, so I think it’s a problem with my script.
Any help would be appreciated!
My script:
resource “vsphere_virtual_machine” “vm” {
name = “terraform-test”
resource_pool_id = <resource_pool_id>
datastore_id = “${data.vsphere_datastore.datastore.id}”num_cpus = 2
memory = 4096
guest_id = “windows8Server64Guest”network_interface {
network_id = “${data.vsphere_network.network.id}”
}disk {
label = “disk0”
size = 100
}cdrom {
datastore_id = “${data.vsphere_datastore.datastore.id}”
path = <path/to/iso>
}
}
Terraform v0.15.0
on windows_amd64
provider Terraform Registry v1.26.0
Steps to Reproduce:
- terraform init
- terraform apply
- Open VCSA and test the VM