Ok, but it's still not clear what you are asking. The term "hiera resource" is not meaningful, so I can only guess at what you mean when you ask about creating one. My first guesses at what it means to "create hiera resource would involve you editing your Hiera data files, however, which is not ordinarily something to which Puppet code structure has any relevance. So what in the world are you talking about?
It's still not clear what, specifically, you are asking. Hiera is just a data service. Site and machine data are very important for using Puppet effectively, and Hiera therefore plays a central role, but in the end it's still just a data service. You cannot declare resources with Hiera, nor can you declare classes. The example data you present has no inherent
effect at all -- it's just data.
Much of the data is, however, structured in a way that will be meaningful to the catalog builder under certain circumstances. It also contains data that match up with a common convention by which manifests can use Hiera data to determine which classes to declare. But these are properties of how the data are used, not of the data themselves.
I guess in the end the question you are posing seems likely to fall into one of two general categories:
- How to write Puppet manifest code that can make effective use of Hiera data to declare resources, or
- How to write Puppet code that declares resources based on specific data you have already in hand.
Neither of those seems complete, however, inasmuch as one normally needs to design manifests and data together. Moreover, there is no one approach that is ideal for every circumstance and person. We can talk about this in the context of a specific example -- maybe elasticsearch -- but that needs to start with your requirements for the resulting configuration of target nodes, and any implementation requirements / preferences you may have. If you have existing manifest code (even if it's just
hiera_include('classes')) and data to start with then that might be helpful both as a starting point and to further clarify what you're after.
John