title: Terraform - Invalid index error with multiple count
body: <p>I am trying to configure 2 Public IP address, with 2 Network interface. What I have written so far is :</p>
  
  <pre><code>resource "azurerm_public_ip" "example" {
    name                    = "test-pip${count.index}"
    count = 2
    location                = "${azurerm_resource_group.rc.location}"
    resource_group_name     = "${azurerm_resource_group.rc.name}"
    allocation_method       = "Dynamic"
    idle_timeout_in_minutes = 30
  }
  output "public_ip_address" {
    value = "${azurerm_public_ip.example.*.id}"
  }
  
  resource "azurerm_network_interface" "main" {
    name                = "test${count.index}"
    count = 2
    location            = "${azurerm_resource_group.rc.location}"
    resource_group_name = "${azurerm_resource_group.rc.name}"
  
      ip_configuration {
      name                          = "testconfiguration1${count.index}"
      subnet_id                     = "${azurerm_subnet.internal.id}"
      private_ip_address_allocation = "Dynamic"
      public_ip_address_id          = "${azurerm_public_ip.example[count.index].id}"
    }
  }
  </code></pre>
  
  <p>Later I will use these two IP, and NI to assign them to 2 VM machines.</p>
  
  <p>When I run <code>terraform plan</code> , I get an error saying :</p>
  
  <p><a href="https://i.stack.imgur.com/2eLcU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2eLcU.png" alt="enter image description here"></a></p>
  
  <p>Terraform version  is <code>"v0.12.3"</code> and azure provider version is <code>"v1.40.0"</code></p>