Virtual and exported resources

To understand exported resources, it first helps to understand virtual resources. Virtual resources declare a state that could be made available, but will not be enforced until declared with the realize function. These resources are designed to allow you to prepublish a resource, but only enforce it if other conditions are met. Virtual resources help overcome the single declaration challenge that can emerge in Puppet code if you have multiple manifests that need to generate the same resource—you may need to include more than one of these manifests on a single node. If multiple modules need to manage the same file, consider virtualizing the resource, and making that resource available from multiple modules.

Get Mastering Puppet 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.