Several words in the Puppet language are reserved. This means they:
Note: As of Puppet 3, reserved words MAY be used as names for attributes in custom resource types. This is a change from the behavior of 2.7 and earlier.
The following words are reserved:
and— expression operator
case— language keyword
class— language keyword
default— language keyword
define— language keyword
else— language keyword
elsif— language keyword
false— boolean value
if— language keyword
in— expression operator
import— language keyword
inherits— language keyword
node— language keyword
or— expression operator
true— boolean value
undef— special value
unless— language keyword
The following words are reserved for future use:
The following are built-in namespaces used by Puppet and so must not be used as class names:
main— Puppet automatically creates a
mainclass, which contains any resources not contained by any other class.
settings— The automatically created
settingsnamespace contains variables with the settings available to the compiler (that is, the Puppet master’s settings).
The following variable names are reserved, and you must not assign values to them:
$string— If a variable with this name is present, all templates and inline templates in the current scope will return the value of
$stringinstead of whatever they were meant to return. This is a bug rather than a deliberate design, and can be tracked at issue #14093.
$0— These regex capture variables are automatically set by regular expressions used in conditional statements, and their values do not persist outside their associated code block or selector value. Puppet’s behavior when these variables are directly assigned a value is undefined.
$factsvariables are reserved for facts and cannot be reassigned at local scopes.
Puppet limits the characters you can use when naming language constructs.
Note: In some cases, names containing unsupported characters will still work. These cases should be considered bugs, and may cease to work at any time. Removal of these bug cases will not be limited to major releases.
Variable names begin with a
$ (dollar sign) and can include:
Puppet 3.8 deprecates the use of uppercase letters for the first non-$ character of a variable name. Variable names are case-sensitive. Note that some variable names are reserved.
Variable names should match the following regular expression:
Variable names can be fully qualified to refer to variables from foreign scopes. Qualified variable names look like
$class::name::variable_name. They begin with
$, the name of the class that contains the variable, and the
:: (double colon) namespace separator, and end with the variable’s local name.
Qualified variable names should match the following regular expression:
The names of classes, defined types, and custom types can consist of one or more namespace segments. Each namespace segment must begin with a lowercase letter and can include:
Namespace segments should match the following regular expression:
The one exception is the top namespace, whose name is the empty string.
Multiple namespace segments can be joined together in a class or type name with the
:: (double colon) namespace separator.
Class names with multiple namespaces should match the following regular expression:
Additionally, you cannot use the name
<MODULE NAME>::init for a class or defined type. This is because
init.pp is a reserved filename, which should contain a class named after the module.
Module names obey the same rules as individual class/type namespace segments. That is, they must begin with a lowercase letter and can include:
Module names should match the following regular expression:
Class and defined type parameters begin with a
$ (dollar sign), and their first non-
$ character must be a lowercase letter. They can include:
Parameter names should match the following regular expression:
Tags must begin with a lowercase letter, number, or underscore, and can include:
Tag names should match the following regular expression:
Resource titles can contain any characters whatsoever. They are case-sensitive.
Resource names (or namevars) might be limited by the underlying system being managed. (E.g., most systems have limits on the characters allowed in the name of a user account.) The user is generally responsible for knowing the name limits on the platforms they manage.
The set of characters allowed in node names is undefined in this version of Puppet. For best future compatibility, you should limit node names to letters, numbers, periods, underscores, and dashes. (That is, node names should match
Environment names can contain lowercase letters, numbers, and underscores. That is, they must match the following regular expression: