title: Merge maps inside list in terraform
body: <p>I have a list of maps like this -</p>
  
  <pre><code>[
    {
      "outer_key_1" = [
        {
          "ip_cidr" = "172.16.6.0/24"
          "range_name" = "range1"
        },
        {
          "ip_cidr" = "172.16.7.0/24"
          "range_name" = "range2"
        },
        {
          "ip_cidr" = "172.17.6.0/24"
          "range_name" = "range3"
        },
        {
          "ip_cidr" = "172.17.7.0/24"
          "range_name" = "range4"
        },
      ]
    },
    {
      "outer_key_2" = [
        {
          "ip_cidr" = "172.16.5.0/24"
          "range_name" = "range5"
        },
        {
          "ip_cidr" = "172.17.5.0/24"
          "range_name" = "range6"
        },
      ]
    },
  ]
  </code></pre>
  
  <p>I want to merge the maps inside the list. This is in an output variable <code>module.module_name.module_op</code>. </p>
  
  <p>Required Output:</p>
  
  <pre><code>
  {
      "outer_key_1" = [
        {
          "ip_cidr" = "172.16.6.0/24"
          "range_name" = "range1"
        },
        {
          "ip_cidr" = "172.16.7.0/24"
          "range_name" = "range2"
        },
        {
          "ip_cidr" = "172.17.6.0/24"
          "range_name" = "range3"
        },
        {
          "ip_cidr" = "172.17.7.0/24"
          "range_name" = "range4"
        },
      ]
  
      "outer_key_2" = [
        {
          "ip_cidr" = "172.16.5.0/24"
          "range_name" = "range5"
        },
        {
          "ip_cidr" = "172.17.5.0/24"
          "range_name" = "range6"
        },
      ]
  }
  </code></pre>
  
  <p>I have done this using </p>
  
  <pre><code>locals {
    result = merge(module.module_name.module_op[0], module.module_name.module_op[1])
  }
  </code></pre>
  
  <p>How do I do this in a more iterative way. </p>
  
  <p>I will not always only 2 maps in my list, it can be more. </p>
  
  <p>I tried using the for loop in terraform 12 like this - </p>
  
  <pre><code>output "result" {
    value = [ for tuple in module.module_name.module_op : merge(tuple) ]
  }
  </code></pre>
  
  <p>and this - </p>
  
  <pre><code>output "secondary_subnets" {
    value = { for tuple in module.module_name.module_op : merge(tuple) }
  }
  </code></pre>
  
  <p>The first one gives me my input back and the second one gives me an error saying I need to add a key since I am returning an object.</p>
  
  <p>Is there a way to get this done?</p>
  
  <p>Thanks in advance.</p>