fix: remove default values for ept_rvi_mode
and hv_mode
#2230
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I'm removing the default values for
ept_rvi_mode
andhv_mode
from the virtual machine configuration.These properties are overwritten during the "read" phase and cause in uplace updates on the VM even if the configuration hasn't changed.
We should allow the vCenter to control the defaults instead of setting them ourselves
This is my second take at attempting to fix this problem.
My first attempt was unsuccessful and was reverted. It caused in-place updates to VMs managed by configurations created with older versions of the provider.
The reason for this was that I only removed the default values for these attributes. This meant that configurations created with previous versions of the provider had actual values and upgrading to v2.8.0 meant that Terraform was attempting to unset those (since we no longer had the defaults).
The proper way to fix this problem is to not only remove the defaults but mark the attributes as
Computed
.This way Terraform ignores the previously assigned defaults and we can ensure backwards compatibility.
Acceptance tests
Output from acceptance testing:
Ran
TestAccResourceVSphereVirtualMachine_basic
and confirmed that even though the scenario is successful the test fails because the plan is not empty. This is due to the default values forept_rvi_mode
andhv_mode
.This problem is reproducible on most VM tests. Some even have
ignore_changes
blocks to work around this.The problem is visible on the nightly runs https://github.com/hashicorp/terraform-provider-vsphere/actions/runs/8954207241/job/24593567973#step:10:241
I modified the resoruce by removing the defaults and marking the attributes as computed.
Ran
TestAccResourceVSphereVirtualMachine_basic
again and did not observe the problem.I copied the exact same configuration from the test, installed v2.7.0, ran
terraform apply
and thenterraform plan
.I observed that the issue is reproducible. I configured a local override for the provider, ran
terraform plan
on the same configuration but with the binary which contains the fix. I observed that the issue is not reproducible.I manually set values to the two attributes, different than the defaults, ran
terraform apply
and verified that the operation is successful.Release Note
Release note for CHANGELOG:
References
Closes #1902