Forge Home

to_resource

Type conversion functions for string representations of resources

8,370 downloads

8,214 latest version

4.5 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.1.2 (latest)
  • 0.1.0
released Dec 18th 2015
This version is compatible with:
  • Puppet Enterprise >=2015.2.0
  • Puppet >=4.2.1

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'tse-to_resource', '0.1.2'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add tse-to_resource
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install tse-to_resource --version 0.1.2

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

tse/to_resource — version 0.1.2 Dec 18th 2015

to_resource

This module provides two functions designed to assist with importing data that represents Puppet resource types from external sources (or Hiera). This can be specifically useful when trying to import application instance declarations, which are required to specify the nodes parameter, which must be an array of Node resource references.

Functions

to_resource

Accepts a string parameter. Transforms it to a resource reference if the string can be represented as a resource.

resolve_resources

Accepts either a String, Array, or Hash parameter. Recursively transforms all transformable String sub-elements into resource type representations.

Examples

Convert a single string to a resource reference:

$res = "Notify[foo]".to_resource

Convert an array of strings to a resource reference:

$res_arr = ["Notify[foo]", "Anchor[bar]"].resolve_resources

Look up a value and transform any valid string-form resource references it contains to Resource type represenations:

$app_instances = lookup("applications").resolve_resources