Iterate over a deeply nested hiera hash in puppet manifest
<p>I'm working on building a structure for my webservers. I have my setup in hiera, but I can't seem to get puppet to give back the correct types.</p>

<p>In common.yaml</p>

<pre><code>vhosts:
  hostname:
    sitename:
      app_url: value
      app_type: value
</code></pre>

<p>I have multiple sites per vhost and multiple vhosts. In my manifest I'm going to be creating the folder structure and other setup tasks, but for for now I can't even get it to iterate over the sites.</p>

<p>Current manifest:</p>

<pre><code>define application($app_name, $app_url) {
  notice("App Type: ${app_type}")
  notice("App Url: ${app_url}")
}

$vhosts = hiera('vhosts')

$vhosts.each |$vhost| {
  create_resources(application, $vhost)
}
</code></pre>

<p>The error I get is that <code>create_resources</code> requires a Hash. However, if I type cast <code>$vhost</code> I get that it's not a Hash but a Tuple. </p>

<p>How did I get a Tuple out of my yaml hash? Is there a better way to iterate over this data set to get what I need?</p>