Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ept_rvi_mode and hv_mode always attemp to update on apply #1902

Closed
4 tasks done
ghost opened this issue May 11, 2023 · 24 comments · Fixed by #2230
Closed
4 tasks done

ept_rvi_mode and hv_mode always attemp to update on apply #1902

ghost opened this issue May 11, 2023 · 24 comments · Fixed by #2230
Assignees
Labels
bug Type: Bug

Comments

@ghost
Copy link

ghost commented May 11, 2023

Community Guidelines

  • I have read and agree to the HashiCorp Community Guidelines .
  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • 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

@ghost ghost added bug Type: Bug needs-triage Status: Issue Needs Triage labels May 11, 2023
@github-actions
Copy link

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.

@uprightvinyl
Copy link

Seeing the same behaviour; ESXi & vCenter 8.0.1, Terraform v1.4.6, vSphere provider v2.4.0.

@tenthirtyam
Copy link
Collaborator

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

var virtualMachineVirtualExecUsageAllowedValues = []string{
string(types.VirtualMachineFlagInfoVirtualExecUsageHvAuto),
string(types.VirtualMachineFlagInfoVirtualExecUsageHvOn),
string(types.VirtualMachineFlagInfoVirtualExecUsageHvOff),
}
var virtualMachineVirtualMmuUsageAllowedValues = []string{
string(types.VirtualMachineFlagInfoVirtualMmuUsageAutomatic),
string(types.VirtualMachineFlagInfoVirtualMmuUsageOn),
string(types.VirtualMachineFlagInfoVirtualMmuUsageOff),
}

"hv_mode": {
Type: schema.TypeString,
Optional: true,
Default: string(types.VirtualMachineFlagInfoVirtualExecUsageHvAuto),
Description: "The (non-nested) hardware virtualization setting for this virtual machine. Can be one of hvAuto, hvOn, or hvOff.",
ValidateFunc: validation.StringInSlice(virtualMachineVirtualExecUsageAllowedValues, false),
},
"ept_rvi_mode": {
Type: schema.TypeString,
Optional: true,
Default: string(types.VirtualMachineFlagInfoVirtualMmuUsageAutomatic),
Description: "The EPT/RVI (hardware memory virtualization) setting for this virtual machine. Can be one of automatic, on, or off.",
ValidateFunc: validation.StringInSlice(virtualMachineVirtualMmuUsageAllowedValues, false),
},

@captainfalcon23
Copy link

Same issue encountered today with latest provider and latest Vmware vCenter 8.0.1.

@gmintoco
Copy link

gmintoco commented Aug 4, 2023

same issue for us with latest provider and vcenter 8

@tenthirtyam tenthirtyam added this to the Backlog milestone Aug 7, 2023
@kbpsec
Copy link

kbpsec commented Aug 25, 2023

Same here. We have reproduced this on vCenter 8 and esxi 8. If vCenter 8 with esxi 7 works fine.

@pramodsharma62
Copy link

Any update on this? I am running into same issue with latest provider.

@DSI-BenThomas
Copy link

Can confirm also hit the issues on vCenter 8U1a and ESXi 8U1a (VCF5)

@LargoUsagi
Copy link

LargoUsagi commented Nov 2, 2023

Can confirm this on hosts using ESXi and vCenter 8.0.2, ESXi 6.7 do not have the unintended side effects.

@Hello-User
Copy link

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).

@smhick
Copy link

smhick commented Jan 2, 2024

same issue for us with latest provider and vcenter 8

@micropbl4
Copy link

We face the same problem:
Terraform v1.6.0
Terraform Provider v2.5.1
VMware vSphere v8.0.1

@nc-td
Copy link

nc-td commented Jan 5, 2024

im hitting this too

@Aly-ona
Copy link

Aly-ona commented Jan 11, 2024

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

@smooti
Copy link

smooti commented Jan 18, 2024

same issue

@Flumeded
Copy link

Same issue
Workaround for now to add

lifecycle {
ignore_changes = [hv_mode, ept_rvi_mode]
}

to the resource

@tenthirtyam
Copy link
Collaborator

@stoyan-hristov - can you look into this one as well?

@spacegospod
Copy link
Collaborator

@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

@tenthirtyam
Copy link
Collaborator

Reverted in 2.8.1. Reopening.

@tenthirtyam tenthirtyam reopened this May 8, 2024
@tenthirtyam tenthirtyam added this to the On Deck milestone May 8, 2024
@spacegospod spacegospod modified the milestones: On Deck, v3.0.0 May 15, 2024
@spacegospod
Copy link
Collaborator

Going to reintroduce the fix as a breaking change in the next major release

@DamienDaco
Copy link

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?

@spacegospod
Copy link
Collaborator

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

@tenthirtyam
Copy link
Collaborator

Research Note: Was reported in #2202 (comment) that this issue is not observed in vSphere 7. Verification reequired.

@tenthirtyam tenthirtyam changed the title vsphere_virtual_machine will be updated in-place ept_rvi_mode and hv_mode always attemp to update on apply Jun 12, 2024
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2024
@tenthirtyam tenthirtyam removed this from the v3.0.0 milestone Sep 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.