Declaring Puppet Resources

A resource definition specifies the content and behavior of a resource class or type. You must define a resource class or type before you can declare it in a manifest.

A resource declaration describes the desired state for a resource on the managed system. The Puppet Server compiles resource declarations into a catalog for each managed system. Puppet applies each catalog to its corresponding managed system to ensure that its system state matches the specified desired state.

Puppet uses the following format for resource declarations:

resource_type { 'title':
  attribute1 => 'value1',
  attribute2 => 'value2',
}
resource_type

Specifies the type of resource that is being declared. Note that the resource_type cannot include quotation marks.

title

Specifies a unique identifying string for every resource_type. The title does not need to match the name of the resource.

attribute

Specifies the desired state of the resource. Most resources have a set of required attributes (or parameters) and might include a set of optional attributes.

Attribute-value pairs must consist of the following:

  • An attribute name that is a lowercase word with no quotes.

    Each attribute name handles some aspect of the resource. Each resource type has its own set of available attributes.

  • An arrow (=>) that is also called a “fat comma” or a “hash rocket”.

  • A value that can be any data type.

    The data type of the value depends on what the attribute accepts.

You can use any amount of white space in a resource declaration. See Language: Resources.