title: azurerm_virtual_machine does not have attribute identity.0.principal_id
body: <p>tf 0.11.11 and 
  azurerm 0.31.0</p>
  
  <p>I have been having a go at this for some time now but I am missing something.</p>
  
  <p>I spun up a handful of azurerm_virtual_machine resources without the identity{} block.
  After the machines are up, I wanted to add one:</p>
  
  <h2>./modules/linux/main.tf</h2>
  
  <pre><code>resource "azurerm_virtual_machine" "instance" {
    count                 = "${length(compact(var.hosts))}"
  
    name                  = "${var.hosts[count.index]}"
    location              = "${data.azurerm_resource_group.instance.location}"
    resource_group_name   = "${data.azurerm_resource_group.instance.name}"
  
    identity {
      type  = "SystemAssigned"
    }
  }
  
  output "system_assigned_identity_principal_ids" {
    value       = "${azurerm_virtual_machine.instance.*.identity.0.principal_id}"
    depends_on  = [ "azurerm_virtual_machine.instance" ]
  }
  </code></pre>
  
  <h2>./main.tf</h2>
  
  <pre><code>module "linuxvm" {
    source = "./modules/linux"
  
    hosts = [ "${var.hostnames}" ]
    resource_group_name = "${module.sample_resource_group.name}"
    resource_tags = "${var.resource_tags}"
  }
  </code></pre>
  
  <p>During terraform plan, I am getting this error:
  Error: Error running plan: 1 error(s) occurred:</p>
  
  <pre><code>* module.linuxvm.output.system_assigned_identity_principal_ids: Resource
  'azurerm_virtual_machine.instance' does not have attribute 
  'identity.0.principal_id' for variable 
  'azurerm_virtual_machine.instance.*.identity.0.principal_id'
  </code></pre>
  
  <p>in the state file, there are no other identity attributes (which is expected). The vm's were first created without the identity block.</p>
  
  <pre><code>[user@host test]$ terraform show | grep iden
    identity.# = 0
    identity.# = 0
    identity.# = 0
  </code></pre>
  
  <p>If I create vms from scratch, I don't see this issue at all
  If I comment out the output block, terraform plan goes through.
  I ran out of things to try at this point.</p>
  
  <p><strong>edit:</strong>
  I have another observation. If I change the output from:</p>
  
  <pre><code>azurerm_virtual_machine.instance.*.identity.0.principal_id
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>azurerm_virtual_machine.instance.0.identity.0.principal_id
  </code></pre>
  
  <p>terraform plan goes through. I have 3 hosts, 0-2 goes through, but using splat wouldn't. </p>