hiera data source in using puppet syntax?

This post on the puppet-users mailing list describes the basic usage.

Rewritten with a more complete example, with Hierarchy:

Given a hiera.yaml like this:

:backends:
  - puppet
:puppet:
  :datasource: data
:hierarchy:
  - %{osfamily}::%{operatingsystem}::%{architecture}
  - %{osfamily}::%{operatingsystem}
  - %{osfamily}
  - global

And given a simple class within a module:

class foo::bar {
  $baz = hiera('baz')
}

The backend will look for a class containing the variable $baz in the following order:

data::RedHat::CentOS::x86_64
data::RedHat::CentOS
data::RedHat
data::global
foo::bar::data
foo::data

The default datasource name is data, but that can be customized. Given klaatu, it would search:

klaatu::RedHat::CentOS::x86_64
klaatu::RedHat::CentOS
klaatu::RedHat
klaatu::global
foo::bar::klaatu
foo::klaatu

The last two appear to be added regardless of the hierarchy, and always in the format of %{calling_class}::%{datasource} and %{calling_module}::%{datasource}.

There appear to be limits to what sorts of facts you can use in these hierarchies vs. a yaml backend. For example, %{clientcert} won't be usable since dots are not allowed in class names.