terraform-provider-vsphere
terraform-provider-vsphere copied to clipboard
vsphere_virtual_machine will be updated in-place
Community Guidelines
- [X] I have read and agree to the HashiCorp Community Guidelines .
- [X] Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
- [X] Do not leave "+1" or other comments that do not add relevant information or questions.
- [X] If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Terraform
v1.4.6
Terraform Provider
v2.3.1 and v2.4.0
VMware vSphere
v8.0.1
Description
After a virtual machine is created using the provider, after running an apply again Terraform wants to update the virtual-machine in-place as the fields ept_rvi_mode
and hv_mode
are constantly being changed even without touching those fields.
It looks like that the provider is using one of automatic
, on
or off
, where VSphere unsets the field to an empty string ""
.
As a work-around I can use the following block
lifecycle {
ignore_changes = [
ept_rvi_mode,
hv_mode
]
}
Affected Resources or Data Sources
resource/vsphere_virtual_machine
Terraform Configuration
Debug Output
Panic Output
No response
Expected Behavior
No changes
Actual Behavior
# module.workers["worker-06"].vsphere_virtual_machine.main will be updated in-place
~ resource "vsphere_virtual_machine" "main" {
+ ept_rvi_mode = "automatic"
+ hv_mode = "hvAuto"
id = "..."
name = "vm-01"
tags = []
# (69 unchanged attributes hidden)
Steps to Reproduce
Run a terraform apply
immediatly followed by a new run of terraform apply
Environment Details
No response
Screenshots
No response
References
No response
Hello, ebruurs! 🖐
Thank you for submitting an issue for this provider. The issue will now enter into the issue lifecycle.
If you want to contribute to this project, please review the contributing guidelines and information on submitting pull requests.
Seeing the same behaviour; ESXi & vCenter 8.0.1, Terraform v1.4.6, vSphere provider v2.4.0.
Both default to automatic. One option may be to set these to computed like was done for annotation recently but they would still use the validation. cc @appilon
https://github.com/hashicorp/terraform-provider-vsphere/blob/29a4c6ce2e7723e3bbeb58c5f12d5292b82c1b6c/vsphere/virtual_machine_config_structure.go#L26-L36
https://github.com/hashicorp/terraform-provider-vsphere/blob/29a4c6ce2e7723e3bbeb58c5f12d5292b82c1b6c/vsphere/virtual_machine_config_structure.go#L127-L140
Same issue encountered today with latest provider and latest Vmware vCenter 8.0.1.
same issue for us with latest provider and vcenter 8
Same here. We have reproduced this on vCenter 8 and esxi 8. If vCenter 8 with esxi 7 works fine.
Any update on this? I am running into same issue with latest provider.
Can confirm also hit the issues on vCenter 8U1a and ESXi 8U1a (VCF5)
Can confirm this on hosts using ESXi and vCenter 8.0.2, ESXi 6.7 do not have the unintended side effects.
Still an issue, even after manually defining the fields.
Latest version of the provider. vCenter 8.0.1 (build 21815093) and ESXi 8.0.2 (build 22380479).
same issue for us with latest provider and vcenter 8
We face the same problem: Terraform v1.6.0 Terraform Provider v2.5.1 VMware vSphere v8.0.1
im hitting this too
We hit same issue with: Terraform v1.3.7 registry.terraform.io/hashicorp/vsphere v2.6.0 esxi: 8.0.2 22380479 vcenter: 8.0.2.00000
same issue
Same issue Workaround for now to add
lifecycle { ignore_changes = [hv_mode, ept_rvi_mode] }
to the resource
@stoyan-hristov - can you look into this one as well?
@tenthirtyam We can't make them computed and keep the default value at the same time. Terraform does not permit this combination.
Just removing the defaults solves the problem. We can stll apply them in the create method if necessary
Reverted in 2.8.1. Reopening.
Going to reintroduce the fix as a breaking change in the next major release
Vsphere provider 2.8.1 Vsphere 8.0.2.00300
I'm still having the issue, VM are rebooting. I've implemented the workaround with the lifecycle from above.
Just to make sure, is 2.8.1 supposed to fix the issue, or am I missing something?
Vsphere provider 2.8.1 Vsphere 8.0.2.00300
I'm still having the issue, VM are rebooting. I've implemented the workaround with the lifecycle from above.
Just to make sure, is 2.8.1 supposed to fix the issue, or am I missing something?
Hey @DamienDaco The fix was released with 2.8.0 but it caused updates to running VMs created with older versions so we decided to issue a patch and revert this change in 2.8.1
We consider this fix to be a breaking change since it can interrupt running workloads because the update to the configuration triggers a power cycle on the VMs.
We try to allow breaking changes only on major releases, that is why the fix for this issue will likely land with v3.0.0
Research Note: Was reported in https://github.com/hashicorp/terraform-provider-vsphere/issues/2202#issuecomment-2124459375 that this issue is not observed in vSphere 7. Verification reequired.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.