Future Parser: Resource Default Statements

This version is out of date. For current versions, see Puppet packages and versions.

Resource default statements let you set default attribute values for a given resource type. Any resource declaration within the area of effect that omits those attributes will inherit the default values.


    Exec {
      path        => '/usr/bin:/bin:/usr/sbin:/sbin',
      environment => 'RUBYLIB=/opt/puppet/lib/ruby/site_ruby/1.8/',
      logoutput   => true,
      timeout     => 180,

The general form of resource defaults is:

  • The resource type, capitalized. (If the resource type has a namespace separator (::) in its name, every segment must be capitalized. E.g., Concat::Fragment.)
  • An opening curly brace.
  • Any number of attribute and value pairs.
  • A closing curly brace.

You can specify defaults for any resource type in Puppet, including defined types.


Within the area of effect, every resource of the specified type that omits a given attribute will use that attribute’s default value.

Attributes that are set explicitly in a resource declaration will always override any default value.

Resource defaults are evaluation-order independent — that is, a default will affect resource declarations written both above and below it.

Area of Effect

Puppet still uses dynamic scope for resource defaults, even though it no longer uses dynamic variable lookup. This means that if you use a resource default statement in a class, it has the potential to affect any classes or defined types that class declares. See here for a full description of scope rules.

You can declare global resource defaults in the site manifest outside any node definition.

Overriding Defaults From Parent Scopes

Resource defaults declared in the local scope will override any defaults received from parent scopes.

Overriding of resource defaults is per attribute, not per block of attributes. Thus, local and parent resource defaults that don’t conflict with each other will be merged together.

Puppet sites use proprietary and third-party cookies. By using our sites, you agree to our cookie policy.