title: Use Terraform Locals for list object {type = list(object({}))}
body: <p>Please how do I simplify this configuration using locals, the code works fine as is but gets complex passing the variables manually each time.</p>
  <p>VARIABLES:</p>
  <pre><code>variable &quot;vm_all&quot; {
      type = list(object({}))
      default = [
        {
          name        = &quot;vm1&quot;
          rg  = &quot;rg1&quot;
          sn  = &quot;sn1&quot;
          sn_prefix = [&quot;10.0.1.0/24&quot;]
            },
        {
          name        = &quot;vm2&quot;
          rg  = &quot;rg2&quot;
          sn  = &quot;sn2&quot;
          sn_prefix = [&quot;10.0.2.0/24&quot;]
            },
        {
          name        = &quot;vm3&quot;
          rg  = &quot;rg3&quot;
          sn  = &quot;sn3&quot;
          sn_prefix = [&quot;10.0.3.0/24&quot;]
            }
      ]
      }
  </code></pre>
  <p>CURRENT ITERATION USING LOCALS:(requires manually mapping the variables as shown above)</p>
  <pre><code>resource &quot;example_resource&quot; &quot;resource1&quot; {
      for_each     = {for vm_all in var.vm_all:  vm_all.name =&gt; vm_all }
      name         = each.value.name
      rg           = each.value.rg
      sn           = each.value.sn
      sn_prefix    = each.value.sn_prefix
  }
  </code></pre>
  <p>DESIRED METHOD OF PASSING VARIABLES:</p>
  <pre><code> variable &quot;name&quot; {
      default = [
      &quot;vm1&quot;,
      &quot;vm2&quot;,
      &quot;vm3&quot;
  ]
   }
  
   variable &quot;rg_names&quot; {
      default = [
      &quot;rg1&quot;,
      &quot;rg2&quot;,
      &quot;rg3&quot;
  ]
   }
  
  variable &quot;subnets&quot; {
      default = [
      &quot;sn1&quot;,
      &quot;sn2&quot;,
      &quot;sn3&quot;
  ]
   }
  
  variable &quot;subnet_prefixes&quot; {
      default = [
      &quot;sn_prefix1&quot;,
      &quot;sn_prefix2&quot;,
      &quot;sn_prefix3&quot;
  ]
   }
  </code></pre>
  <p>QUESTION: How can I use locals in a more effective way to allow passing the variables as lists shown above and avoid the need to map manually?</p>