title: Error: Unsupported attribute , each.value is object with 2 attributes
body: <p>i’m trying to create multiple Network interfaces by using for_each and locals, here is my code</p>
  <pre><code>locals {
    network_interfaces = {
      a = {
        subnet_id      = module.vpc.public_subnets[0],
        security_group = [aws_security_group.ssh.id],
      },
  
      b = {
        subnet_id       = module.vpc.public_subnets[0],
        security_groups = [aws_security_group.ssh.id],
      },
      c = {
        subnet_id       = module.vpc.public_subnets[1],
        security_groups = [aws_security_group.ssh.id],
      },
      d = {
        subnet_id       = module.vpc.public_subnets[1],
        security_groups = [aws_security_group.ssh.id],
      },
  
    }
  
  }
  </code></pre>
  <p>and here i’m trying to iterate over the local.network_interfaces with for_each so I can create 4 network interfaces</p>
  <pre><code>resource &quot;aws_network_interface&quot; &quot;this&quot; {
    for_each  = local.network_interfaces
    subnet_id = each.value.subnet_id
    security_groups = each.value.security_groups
    tags = {
      Name = &quot;${each.key}_network_interface&quot;
    }
  }
  </code></pre>
  <p>but when i run Terraform apply, it gives me this error</p>
  <pre><code>│ Error: Unsupported attribute
  │ 
  │   on main.tf line 61, in resource &quot;aws_network_interface&quot; &quot;this&quot;:
  │   61:   security_groups = each.value.security_groups
  │     ├────────────────
  │     │ each.value is object with 2 attributes
  │ 
  │ This object does not have an attribute named &quot;security_groups&quot;
  </code></pre>
  <p>any help will be appreciated</p>