title: Interpolation with for loop in subelement of a resource where the resource itself is using for_each
body: <p>For example here is a resource (very simplified) being deployed with for_each (the for_each isnt where Im having problems, I can do that all day - its trying to get the data in the ovf_network_map correctly interpolated is where Im having problems):</p>
  
  <pre><code>resource "vsphere_virtual_machine" "vmFromLocalOvf" {
    for_each = var.customers[var.customer][var.idc].vms
    ...snip...
    ovf_deploy {
      local_ovf_path = "cucm_11.5_vmv8_v1.1.ovf"        
      ovf_network_map = {
        for net in ["INSIDE", "OUTSIDE"]:
        "eth${count.index}" =&gt; data.vsphere_network.net.id
      }
  </code></pre>
  
  <p>For this simplified example, the goal there is to end up where ovf_network_map contains { "eth0" = data.vsphere_network.INSIDE.id, "eth1" = data.vsphere_network.OUTSIDE.id }
  (obviously, that data objects will be further interpolated there, but hopefully the issue comes across here of what Im trying to accomplish).</p>
  
  <p>There are 2 errors:
  <code>The "count" object can be used only in "resource" and "data" blocks, and only
  when the "count" argument is set.</code>
  also
  <code>A data resource "vsphere_network" "net" has not been declared</code>, Obviously my interpolation there is wrong.  Hopefully the interpolation I need here is possible - Im probably going about this the wrong way -  any ideas?</p>
  
  <p><strong>Edit to add:</strong> Ive been able to figure out the numeric counting for eth0, eth1 with this: <code>eth${index(slice(var.customers[var.customer][var.idc].vms[each.key], 3, length(var.customers[var.customer][var.idc].vms[each.key]) - 1), net)}" =&gt; data.vsphere_network.net.id</code></p>
  
  <p>So now all thats left - im stuck with trying to "double" interpolate the "net" there in <code>data.vsphere_network.net.id</code> as I get error <code>A data resource "vsphere_network" "net" has not been declared</code></p>