title: puppet, getting the $name when instantiating a resource type with an array
body: <p>using puppet, i need to create three files, with this content:</p>
  
  <pre><code>/tmp/f1.txt: hello /tmp/f1.txt
  /tmp/f2.txt: hello /tmp/f2.txt
  /tmp/f3.txt: hello /tmp/f3.txt
  </code></pre>
  
  <p>i try as follows:</p>
  
  <pre><code>$path="/tmp/"
  $my_files = ["$path/f1.txt", "$path/f2.txt", "$path/f3.txt"]
  file { $my_files:
    ensure =&gt; file,
    content =&gt; "hello $name\n",
  }  
  </code></pre>
  
  <p>however this does not work because $name is undefined.</p>
  
  <p>is there a variable that gets instantiated for each 'iteration' and that i can use?</p>
  
  <p>ps: i am aware that i could create a new resource type as follows:</p>
  
  <pre><code>define file_with_content {
    file { $name:
      ensure =&gt; file,
      content =&gt; "hello $name\n",
    }  
  }
  $path="/tmp/"
  $my_files = ["$path/f1.txt", "$path/f2.txt", "$path/f3.txt"]
  file_with_content { $my_files: }
  </code></pre>
  
  <p>but this requires creating a new resource type,
  and I cannot do this in my context (which is not explained here).</p>
  
  <p>the question is, how to modify the first code to make it work, without defining a new resource type, nor executing shell code?</p>