Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
r/virutal_machine: Fix gateway discovery behavior
The current gateway discovery code makes an assumption that any device tracked by VMware tools that is not virtual hardware on the instance will be ordered after any devices that are (even though the device key is properly being used as the source of truth when discovering interfaces). It does this by using the device index in a specific gateway entry as the literal index entry for the corresponding device in the list of devices that have actually been counted for saving in Terraform state. This will either point to the incorrect device or a flat out out-of-bounds value, respectively causing incorrect diffs or crashes. This fixes the situation by searching for the actual device key in the guest network information discovered by VMware tools - at the index specified by the gateway entry, and then searching for that key in the devices being counted for state. The index of the corresponding entry is where the gateway is saved. If any of these searches come up dry, either the gateway has legitimately moved and needs to be fixed or more than likely was not defined in config. Fixes #173.
- Loading branch information