-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Terraform and Azure: no way to control NIC ordering on a VM #140
Comments
Hi, Thanks |
Hi Satish, turns out there could be or there is a workaround. I'm not sure how deterministic it will be. But here is what I found. I empirically over numerous trials identified that when three interfaces are specified, Terraform presents them as VNIC0, VNIC2, VNIC 1 for example. This was pretty consistent. So what I did was bit the bullet and then switched up the subnets that VNIC1 and VNIC2 were attached to. Hope this helps. |
@vinayvenkat Thanks! Yes that seems to work - though I will have to do more trials. What does this mean though...? Is it deterministic but just the incorrect order - or is it indeterministic and we are just hitting on the correct hash lookup order.... |
It's random. Reversing the order in the code doesn't work reliably. This needs to be addressed. 1 launch may produce the correct results, a second launch may have 1 firewall with reversed interfaces and a third launch may have both firewalls with reversed interfaces. The order should be defined in the coding and be reliable, which right now it's not. Please fix this. |
@kblackstone - on digging further it seems that the issue is with Azure itself. Azure doesn't seem to guarantee that the interfaces will be attached to the VM in deterministic order. For instance, see this article: http://vaggeliskappas.com/2015/01/06/create-virtual-machine-multiple-nics-azure-iaas/ I tried fixing it in the AzureRM terraform provider to make the order deterministic - but it didn't help. They still show up in random order. I ended up fixing it in the boot scripts inside my VM - figure out which subnet a particular interface is attached to, and use that in the scripts. HTH, |
Appreciate you digging into this. Any idea why an ARM template would provide more consistent results? |
Fixed in #426 |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Terraform Version
Terraform v0.9.5
Terraform Configuration Files
Debug Output
azurerm_virtual_machine.VV_FW_Web: Creating...
availability_set_id: "" => ""
delete_data_disks_on_termination: "" => "false"
delete_os_disk_on_termination: "" => "false"
license_type: "" => ""
location: "" => "westus"
name: "" => "web-vm"
network_interface_ids.#: "" => "3"
network_interface_ids.1300869970: "" => "/subscriptions/4b81abdf-236e-4012-a18d-4c5976220c92/resourceGroups/vvrg3/providers/Microsoft.Network/networkInterfaces/FWweb-nic0"
network_interface_ids.2743587454: "" => "/subscriptions/4b81abdf-236e-4012-a18d-4c5976220c92/resourceGroups/vvrg3/providers/Microsoft.Network/networkInterfaces/FWweb-nic2"
network_interface_ids.982418372: "" => "/subscriptions/4b81abdf-236e-4012-a18d-4c5976220c92/resourceGroups/vvrg3/providers/Microsoft.Network/networkInterfaces/FWweb-nic1"
Panic Output
If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the
crash.log
.Expected Behavior
The NIC's should be presented as: VNIC0, VNIC1, VNIC2.
Actual Behavior
The NIC's in the VM configure section were specified as VNIC0, VNIC1, VNIC2. However, when the NIC's are presented to the VM they are ordered as: VNIC0, VNIC2, VNIC1.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
The text was updated successfully, but these errors were encountered: