title: Having some trouble using module hiera in puppet
body: <p>I am having some trouble using module hiera data.</p>
  <p>module: /etc/puppetlabs/code/environments/production/modules/usehiera</p>
  <p>tree structure:</p>
  <pre><code>usehiera
  usehiera/hiera.yaml
  usehiera/data
  usehiera/data/common.yaml
  usehiera/manifests
  usehiera/manifests/init.pp
  </code></pre>
  <p>hiera.yaml:</p>
  <pre><code>---
  version: 5
  defaults:  
    datadir: data
    data_hash: yaml_data
  hierarchy:
    - name: 'common'
    - path: 'common.yaml'
  </code></pre>
  <p>data/common.yaml:</p>
  <pre><code>---
  usehiera::apples: 'this is some data'
  </code></pre>
  <p>manifests/init.pp:</p>
  <pre><code>class usehiera{
      file{'/tmp/hiera_lookup.txt':
          ensure =&gt; present,
          #content =&gt; hiera('oranges') #this works with global hiera
          content =&gt; $apples
      }
  }
  </code></pre>
  <p>As you can see I seem to have the global hiera working with &quot;hiera('oranges')&quot; when I run this module on my node. When I try to use the module hiera data the puppet run finishes successfully but hiera_lookup.txt is just empty.</p>
  <p>Steps I have taken to troubleshoot:</p>
  <ol>
  <li>restart puppetserver after hiera changes</li>
  <li>try using $usehira::apples</li>
  <li>try using hiera('apples')</li>
  <li>moving my hiera.yaml inside data/</li>
  <li>using lookup with --explain doesnt really give me anything useful, just says lookup() not found</li>
  </ol>
  <p>Can anyone help me out? I have been stuck with this for a decent amount of time and not sure what the issue could be.</p>