title: Iterating through a list while already using for_each (Terraform 0.12)
body: <p>I'm currently trying to use TF 0.12 to create AWS Organizations accounts. Right now I have a map of accounts with applicable info, here is an example where "Services" is the account name:</p>
  
  <pre><code>accountMap = {
  ...
    Services = {
      OU          = ["Development", "Production"]
    },
  ...
  }
  </code></pre>
  
  <p>OU refers to the org units the account should be a part of. I'm currently already using for_each to loop through this map of account names, but I'm stuck on how to use the OUs as a suffix, so the org account name would become "Services-Development" and "Services-Production". I have tried similar to the following:</p>
  
  <pre><code>resource "aws_organizations_account" "main" {
    for_each = var.ouMap
  
    name     = "${each.key}-${var.accountMap["${each.value[*]}"]}"
    ...
  }
  </code></pre>
  
  <p>However, "name" requires a string and I get an error since I am providing a list of the OUs, but I may want one account to belong to several OUs or just a single OU. So, how can I either convert the list to a string one at a time, while in the same for_each iteration (but for my differing OUs)?</p>
  
  <p>I'm open to other suggestions on best practice to map AWS Org accounts to multiple OUs as I'm still rather new to Terraform.</p>