title: Puppet fetching specific value of a key from hash
body: <p>My hiera entries -</p>
  
  <pre><code>mysqlconfig::custom_mysql_options:
     mysqld:
       replicate-ignore-db: 'test'
       server-id: 12
       datadir: '/data/mysql_data'
  </code></pre>
  
  <p>I want to get the value of datadir in my puppet module. Please let me know what is the syntax I need to use to fetch this value. I tried something as follows but it doesn't work. </p>
  
  <pre><code>$datadir = hiera('mysqlconfig::custom_mysql_options[datadir]')
  
   file { "$datadir":
   ensure =&gt; directory,
   owner  =&gt; 'mysql',
   group  =&gt; 'mysql',
   mode   =&gt; '0755',
   }
  </code></pre>
  
  <p>Thanks in advance</p>