Forge Home


Puppet hiera_undef module


17,576 latest version

3.1 quality score

Version information

  • 1.1.17 (latest)
  • 1.1.16
  • 1.1.15
  • 1.1.14
  • 1.1.13
  • 1.1.12
  • 1.1.11
  • 1.1.10
  • 1.1.9
  • 1.1.8
  • 1.1.7
  • 1.1.6
  • 1.1.5
  • 1.1.4
  • 1.1.3
  • 1.1.2
  • 1.0.0
released Aug 21st 2015
This version is compatible with:
  • Puppet Enterprise 3.x
  • Puppet 3.x
  • , ,
This module has been deprecated by its author since Feb 10th 2021.

The reason given was: No longer maintained/necessary

Start using this module

Tags: puppet, hiera, undef


camptocamp/hiera_undef — version 1.1.17 Aug 21st 2015

Hiera-undef Puppet Module

Puppet Forge Build Status

This module is provided by Camptocamp

Why this module?

The hiera functions for Puppet are currently limited by the fact that Puppet functions cannot receive the undef value as it gets munged before the function receives it (see ticket #20923).

This module provides replacement functions that do not accept a default parameter, but use undef instead.

This module was written to ease the migration from Puppet 2.7 to 3.0, by writing wrapping classes using the hiera_undef() function. For example:

class wrapping::myapp {
  class { 'myapp':
    param1 => hiera_undef('myapp::param1'),
    param2 => hiera_undef('myapp::param2'),

This approach allows to emulate data binding in Puppet 2.7 since:

  • the name of the variable passed to hiera_undef is of the form $class::$param, compatible with the way data bindings work;
  • if the variable is not found in Hiera, the function returns undef, and the class default is used, just like data bindings would do it.

The advantages of this approach are that:

  • only one level of wrapping classes is necessary (no turtles all the way down with global parameters);
  • it is compatible with both Puppet 2.X and 3.X;
  • the wrapping classes can safely be removed in Puppet 3.X as data binding will replace the calls to hiera_undef().


A simple example might explain better than words. In the following examples, the foobar variable is not found in any Hiera backends in the current scope:

notify { 'test':
  message => hiera('foobar', undef),


Notice: /Stage[main]//Notify[test]/message: defined 'message' as ''


notify { 'test':
  message => hiera_undef('foobar'),


Notice: test
Notice: /Stage[main]//Notify[test]/message: defined 'message' as 'test'


Please report bugs and feature request using GitHub issue tracker.

For pull requests, it is very much appreciated to check your Puppet manifest with puppet-lint to follow the recommended Puppet style guidelines from the Puppet Labs style guide.


Copyright (c) 2013 All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.