Over time the amount of features have grown for hiera and the move into
puppet was because of the increasing difficulties of making an external
hiera do all the required things as the external hiera would have needed
to know about environments and module paths and finding information in
modules, ability to reference to puppet variables etc. etc.
Thus, to use heira 5 as a library, it is basically the same as a
compilation + calls to the lookup function. To do that you would need to
do what the lookup CLI is doing in terms of setup. That would then give
you the full feature set.
There are however several use cases where people want to be able to
instantiate "a hiera" with a hierarchy of their own to do lookups. There
is the beginnings of such an API in puppet, but it is not well
documented and needs a bit more work.
In your case, do you want exactly the same as what a puppet compilation
would see (and support env, module data etc.) or do you need the
functionality of having your own hierarchy somewhere that is not mixed
into puppet?
Hiera 3, the freestanding gem will at some point no longer be supported.
It may be too early to drop it for Puppet 6, but it also depends on when
it will be released. We are currently just fixing critical problems with
the hiera 3 separate gem.
Best,
- henrik
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/