title: how to interate through multiple values in locals in terraform?
body: <p>I want to create an iam policy in terraform , such that I can write policy statement , such as below, but I would like to create a variable such as array and iterate through that to create policy for each resource via terraform.</p>
  <pre><code>   &quot;Effect&quot;: &quot;Allow&quot;, 
      &quot;Action&quot;: &quot;*&quot;
      &quot;Resources&quot; : 
  </code></pre>
  <pre><code>locals{
    resources = [&quot;lambda&quot;, &quot;s3&quot; , &quot;ec2&quot;]
  }
  </code></pre>
  <pre><code>resource &quot;aws_iam_policy&quot; &quot;allowpolicy&quot; {
     name= &quot;resourcesaccessallowed&quot;
     
     #iterate through the resources list here in locals
  }
  </code></pre>