title: Writing Terraform Code for existing Instances aws_lb_target_group_attachment Errors Unsupported Block type
body: <p>I am trying to write code for existing EC2 Instances in aws_lb_target_group_attachment and I get unsupported block type. Here is the code:</p>
  <pre><code>variable &quot;target_id&quot; {
    default = [
      {
        name = &quot;i-123456789abcdefgh&quot;
      },
      {
        name = &quot;i-24680bcgdhkij1234&quot;
      }
    ]
  }
  resource &quot;aws_lb_target_group_attachment&quot; &quot;mytestAlb&quot; {
    target_group_arn = aws_lb_target_group.mytestAlb.arn
    dynamic &quot;target_id&quot; {
      for_each = var.target_id
      content {
        name = target_id.value[&quot;name&quot;]
      }
    }
  }
  </code></pre>
  <p>I get two errors</p>
  <ol>
  <li>Error: missing required arguement, the target_id is required but no definition was found</li>
  <li>Error: Unsupported block type , Blocks of type target_id are not expected here.
  I tried different variable names and that did not work either. Sorry spent long hours so need another pair of eyes. These EC2 instances are up and running..</li>
  </ol>