-
Notifications
You must be signed in to change notification settings - Fork 467
vsphere_host_virtual_switch
resource attempts to change the VMNIC order
#2018
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
Comments
Hello, erSitzt! 🖐 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. |
quick note, i switched cables on the host , where the order was different`and adjusted the json in my terraform project, now terraform detects a change on this host on every run as well. So it might have something to do with |
Hey @erSitzt the only way I was able to reproduce this was to change the failover order outside TF and attempt to plan/apply the original configuration again. There is no special handling in the provider in terms of adapter ordering and there's definitely nothing special about |
i will recheck this tomorrow, but im pretty sure this was a change that terraform would want to do on every run, even if they were only seconds apart with no other process/user changing any settings in vmware. ...but let be verify if this is still happening with current versions... |
@spacegospod Still happening with current version It still happens for all hosts after some time.. not sure what is triggering it. |
Thanks for re-testing. Is the order of the active adapters messed up in the vCenter UI too? |
Nope vCenter is always in the same order. |
Looks like entering maintenance mode was the missing piece of the puzzle. I was able to reproduce the bug in 2 out of 6 attempts, it doesn't happen every time on my setup. I noticed that after exiting maintenance mode the adapters are flipped on the HostVirtualSwitchBondBridge but are left intact on the HostNetworkPolicy. References: |
@spacegospod nice :) thanks for investigating Funny thing why this is happening for all hosts after some time.. first i suspected it had something to do with ha primary election, because that was the first host i sent into maintenance. |
Hey @erSitzt I got back to this issue and it turned out I wasn't quite right about the bond bridge. You see, the active and standby nics are stored in order on the policy object but the only structure that contains the complete set of adapters is still the bond bridge. That means that the only way to identify the assigned but unused adapters is to diff the It looks like the vCenter UI sorts the unused adapters list. For example if you add "vmnic2" and "vmnic1" (in that order) to a swtich and then open up the edit adapters dialog again it would list them as "vmnic1", "vmnic2". In practice the order of the unused adapters doesn't matter since they don't take part in any network traffic. A simpler alternative would be to just ignore any changes to
Is that a viable option for you? I'm not sure if the ordering change after exiting maintenance mode is a bug or not and I don't know if it's reproducible in newer versions of vSphere. I tried with 8.0.3 today and I haven't been able to observe this yet. |
I filed a PR that adds a custom diff check for |
thanks @spacegospod @tenthirtyam |
This functionality has been released in v2.13.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
Community Guidelines
Terraform
v1.5.6
Terraform Provider
v2.4.3
VMware vSphere
v7.0.3
Description
Same problem as in #1503
Current vmnic order is

But terraform wants to update the order on multiple servers.
Fun fact:

I have one server where the vmnic order is the other way round
...and terraform is not trying to reorder the vmnics on this host
To be clear, the current vmnic order on all of those hosts currently matches what is configured in terraform.
Affected Resources or Data Sources
resource/vsphere_host_virtual_switch
Terraform Configuration
Nothing special here i think...
https://gist.github.com/erSitzt/6f7176babcefe6dab8464a3e48e9cda5
The json used here looks like this
Debug Output
https://gist.github.com/erSitzt/bd4661e41f42c054516ff8decfe7449d
Panic Output
No response
Expected Behavior
No change detected..
Actual Behavior
Change detected on every plan/apply run
Steps to Reproduce
Not sure, will add info if i can test more
Environment Details
No response
Screenshots
No response
References
No response
The text was updated successfully, but these errors were encountered: