title: How to correctly use each.value in for_each in terraform?
body: <p>I am trying to create a files for each user with the projects assigned to them as content of the file. I amunable to get the &quot;${each.value}&quot; as it is a list of strings. Any way around this please?</p>
  <pre><code>locals {
    data = {
      &quot;project1&quot; = {
        user_assigned           = [&quot;user1&quot;, &quot;user2&quot;, &quot;user3&quot;]
       }
      &quot;project2&quot; = {
        user_assigned           = [&quot;user2&quot;, &quot;user3&quot;, &quot;user4&quot;]
       }
    }
  
  
  `
  resource &quot;local_file&quot; &quot;foo&quot; {
    for_each = transpose(zipmap(keys(local.data), values(local.data)[*].user_assigned))
    content  = &quot;${each.value}&quot;
    filename = &quot;${each.key}&quot;
  }
  </code></pre>
  <p>Error:</p>
  <pre><code>  on test.tf line 85, in resource &quot;local_file&quot; &quot;foo&quot;:
    85:   content  = &quot;${each.value}&quot;
      |----------------
      | each.value is list of string with 2 elements
  </code></pre>