title: How can I use for_each on a list of maps that have nested maps?
body: <p>For example, I want to have a map that represents a channel that receives alerts. Within that map, I have an &quot;alarms&quot; value that is a list of alarm maps. For each channel map, associated resources are created. For each alarm map, associated resources are created and reference resources created from the parent channel map.</p>
  <pre><code>alarms_list = {
      &quot;alarm-channel1&quot; = {
          channel_description = &quot;Channel description&quot;,
          alarms = {
              ServerDown = {
                  description = &quot;server alarm description&quot;
              },
              LogError = {
                  description = &quot;log alarm description&quot;
              }
          }
      },
      &quot;alarm-channel2&quot; = {
          channel_description = &quot;Channel description&quot;,
          alarms = {
              FooDown = {
                  description = &quot;foo alarm description&quot;
              },
              BarError = {
                  description = &quot;bar alarm description&quot;
              }
          }
      }
  }
  
  resource &quot;channel&quot; &quot;this&quot; {
      for_each = var.alarms_list
      name = each.key
      description = each.value.channel_description
  
  resource &quot;alarm&quot; &quot;this&quot; {
      for_each = ....(a resource created for each alarm nested within alarm-channel1&quot;
      description = ???
  </code></pre>