title: Getting unsupported attribute error in terraform when using for_each expression
body: <p>Using <strong>for_each</strong> expression in Terraform v0.12.6  to dynamically generate inline blocks of vnet subnets (Azure). I have list variable 'subnets' defined, with two subnets 'sub1' and 'sub2' as below</p>
  
  <pre><code>variable "subnets" {
    default = [
      {
        name   = "sub1"
        prefix = "1.1.1.1/32"
      },
      {
        name   = "sub2"
        prefix = "2.2.2.2/32"
      },
    ]
  }
  </code></pre>
  
  <p>then iterate over list variable inside "azurerm_virtual_network" block to create dynamic blocks of subnets</p>
  
  <pre><code>dynamic "subnet" {
      for_each = [for s in var.subnets  : { 
          name   = s.name
          prefix = s.prefix
      }]
  
      content {
        name           = subnet.name
        address_prefix = subnet.prefix
      }   
    }
  }
  </code></pre>
  
  <p>Getting i.e. first one is  <strong>Error: Unsupported attribute</strong></p>
  
  <p><em>on main.tf line 42, in resource "azurerm_virtual_network" "vnet":
    42:       name           = subnet.name</em></p>
  
  <p>This object does not have an attribute named "name".</p>