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

Terraform and Azure: Not possible to specify the NIC ordering on a VM. #15416

Closed
vinayvenkat opened this issue Jun 28, 2017 · 2 comments
Closed

Comments

@vinayvenkat
Copy link

vinayvenkat commented Jun 28, 2017

Terraform Version

Terraform v0.9.5

Terraform Configuration Files

resource "azurerm_network_interface" "VNIC0" {
  name                = "${join("", list("FW", "web-nic", "0"))}"
  location            = "${var.location}"
  resource_group_name = "${azurerm_resource_group.VV_FW_RG.name}"
  depends_on          = ["azurerm_virtual_network.VV_FW_VNET",
                          "azurerm_public_ip.PublicIP_0"]

  ip_configuration {
    name                          = "${join("", list("ipconfig", "0"))}"
    subnet_id                     = "${azurerm_subnet.VV_FW_Subnet0.id}"
    private_ip_address_allocation = "dynamic"
    public_ip_address_id = "${azurerm_public_ip.PublicIP_0.id}"
  }

  tags {
    displayName = "${join("", list("NetworkInterfaces", "0"))}"
  }
}

resource "azurerm_network_interface" "VNIC1" {
  name                = "${join("", list("FW", "web-nic", "1"))}"
  location            = "${var.location}"
  resource_group_name = "${azurerm_resource_group.VV_FW_RG.name}"
  depends_on          = ["azurerm_virtual_network.VV_FW_VNET"]

  ip_configuration {
    name                          = "${join("", list("ipconfig", "1"))}"
    subnet_id                     = "${azurerm_subnet.VV_FW_Subnet1.id}"
    private_ip_address_allocation = "dynamic"
  }

  tags {
    displayName = "${join("", list("NetworkInterfaces", "1"))}"
  }
}

resource "azurerm_network_interface" "VNIC2" {
  name                = "${join("", list("FW", "web-nic", "2"))}"
  location            = "${var.location}"
  resource_group_name = "${azurerm_resource_group.VV_FW_RG.name}"
  depends_on          = ["azurerm_virtual_network.VV_FW_VNET"]

  ip_configuration {
    name                          = "${join("", list("ipconfig", "2"))}"
    subnet_id                     = "${azurerm_subnet.VV_FW_Subnet2.id}"
    private_ip_address_allocation = "dynamic"
  }

  tags {
    displayName = "${join("", list("NetworkInterfaces", "2"))}"
  }
}

resource "azurerm_virtual_machine" "VV_FW_Web" {
  name                  = "web-vm"
  location              = "${var.location}"
  resource_group_name   = "${azurerm_resource_group.VV_FW_RG.name}"
  vm_size               = "${var.gvmSize}"

  storage_image_reference {
    publisher = "${var.imagePublisher}"
    offer     = "${var.imageOffer}"
    sku       = "${var.ubuntuOSVersion}"
    version   = "latest"
  }

  storage_os_disk {
    name          = "web-osdisk"
    vhd_uri       = "${azurerm_storage_account.VV_FW_STG_AC.primary_blob_endpoint}vhds/osdisk-Web.vhd"
    caching       = "ReadWrite"
    create_option = "FromImage"
  }

  os_profile {
    computer_name  = "web-server-vm"
    admin_username = "${var.adminUsername}"
    admin_password = "${var.adminPassword}"
  }

  network_interface_ids = ["${azurerm_network_interface.VNIC0.id}",
                            "${azurerm_network_interface.VNIC1.id}",
                            "${azurerm_network_interface.VNIC2.id}"]
  primary_network_interface = "${azurerm_network_interface.VNIC0.id}"
  tags {
    environment = "staging"
  }
}

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:

  1. terraform apply

Important Factoids

Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

@vinayvenkat vinayvenkat changed the title Terraform and Azure: no way to control NIC ordering on a VM. Terraform and Azure: Not possible to specify the NIC ordering on a VM. Jun 28, 2017
@stack72
Copy link
Contributor

stack72 commented Jun 28, 2017

Closing as this is already here hashicorp/terraform-provider-azurerm#140

@stack72 stack72 closed this as completed Jun 28, 2017
@ghost
Copy link

ghost commented Apr 8, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants