terraform-provider-vsphere: [ESXi] Creating virtual machine fails (PolicyIDByVirtualMachine)
I tried to create a virtual machine on an ESXi server (no vCenter) and received the following error message:
Error: this operation is only supported on vCenter: RESOURCE (52), ACTION (PolicyIDByVirtualMachine)
on test.tf line 46, in resource "vsphere_virtual_machine" "vm":
46: resource "vsphere_virtual_machine" "vm" {
I think the problem is in the following line; https://github.com/terraform-providers/terraform-provider-vsphere/blob/1c52bb0d1124d759df766edf47e4fe1442fc9a96/vsphere/resource_vsphere_virtual_machine.go#L453
Reading a storage policy id will always fail without vCenter since it is not supported.
Community Note
- Please vote on this issue by adding a π reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave β+1β or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform Version / vSphere Provider Version
Terraform v0.12.24
+ provider.vsphere v1.17.1
Affected Resource(s)
vsphere_virtual_machine
Terraform Configuration Files
...
resource "vsphere_virtual_machine" "vm" {
name = "terraform-test"
resource_pool_id = data.vsphere_resource_pool.pool.id
datastore_id = data.vsphere_datastore.datastore.id
num_cpus = 2
memory = 1024
guest_id = "ubuntu64Guest"
wait_for_guest_net_timeout = 0
firmware = "efi"
network_interface {
network_id = data.vsphere_network.network.id
}
disk {
label = "disk0"
size = 20
thin_provisioned = false
}
}
Debug Output (extract)
2020/04/11 10:46:43 [DEBUG] vsphere_virtual_machine.vm: apply errored, but we're indicating that via the Error pointer rather than returning it: this operation is only supported on vCenter: RESOURCE (52), ACTION (PolicyIDByVirtualMachine)
Expected Behavior
terraform apply performs the action successfully
Actual Behavior
terraform apply fails
Steps to Reproduce
terraform apply
Important Factoids
- using ESXi without vCenter
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 24
- Comments: 20 (6 by maintainers)
Problem still present in v2.0.2. Any news ?
@appilon - I was able to test and thus far looks good in regard to the PolicyIDByVirtualMachine message. As far as the other issue PolicyIDByVirtual, I did not experience this issue and I did not see any steps to reproduce. I would be happy to test if you know what it takes to replicate.
Itβs a great to have this as a resource provider for the ESXI as the ability to spin-up and test in lab environments with TF is literally priceless compared to VMWare vCenter and the licensing that goes with it. Thank you for making these changes. I will continue to test as I build out my lab TF deployment and see if anything else comes up.
Do we expect to have this rolled up into next release?
Nope, just appreciate someone giving it some confirmation. The scope of this change was very small so a quick check I think is a reasonable.
I am also seeing this issue. Reverting to 1.15.0 also stopped the error
Reverting to
v1.15.0looks to resolve this specific issue.