title: Creating dynamic resources with Terraform for_each
body: <p>I would like to create AWS SSM Parameters using Terraform, with the parameters being passed in as input variables.</p>
  <p>I see there is a for_each feature, but how can this be applied to top level properties within a terraform resource? From the documentation, the use of for_each appears to be restricted to not work on top level properties of a resource, am I misunderstanding?</p>
  <p>This is what I am trying to accomplish:</p>
  <p>main.tf</p>
  <pre><code>resource &quot;aws_ssm_parameter&quot; &quot;ssm_parameters&quot; {
    for_each = var.params
    content {
        name = name.value
        type  = &quot;String&quot;
        overwrite = true
        value = paramValue.value
  
        tags = var.tags 
        lifecycle {
          ignore_changes = [
            tags,
            value
          ]
        }
    }  
  }
  </code></pre>
  <p>variables.tf</p>
  <pre><code>variable &quot;params&quot; {
    default = [
      {
        name   = &quot;albUrl&quot;
        paramValue = &quot;testa&quot;
      },
      {
        name   = &quot;rdsUrl1&quot;
        paramValue = &quot;testb&quot;
      },
      {
        name   = &quot;rdsUrl2&quot;
        valparamValueue = &quot;testc&quot;
      },
    ]
  }
  </code></pre>