---
page_title: Built-in blocks overview
description: A block is a container for configuration in a Packer template. Learn about the types of configration blocks built into HCL for Packer. 
---

# Built-in blocks overview

This topic provides an overview of the configuration blocks built into the Packer language that you can use to write Packer templates in HCL2.

## Introduction

A block is a container for configuration. You can use the following types of blocks in your Packer templates:

- `build` blocks contain configuration for a specific combination of builders,
  provisioners, and post-processors used to create a specific image artifact.
- `source` blocks contain configuration for builder plugins. Once defined,
  sources can be used and further configured by the "build" block.
- `provisioner` blocks contain configuration for provisioner plugins. These
  blocks are nested inside of a build block.
- `post-processor` and `post-processors` blocks contain configuration for
  post-processor plugins and post-processor plugin sequences. They are also
  nested within `build` blocks.
- `variable` blocks contain configuration for variables that can either be
  defaulted in configuration or set by the user at runtime.
- `locals` blocks contain configuration for variables that can be created using
  HCL functions or data sources, or composited from variables created in the
  variables blocks.

The documentation contains information for each block type.

Other blocks, such as the `packer` block, provide information to the Packer core
about what version it is allowed to run. The `required_plugins` block helps the
Packer core

Blocks can be defined in multiple files and `packer build folder` will build
using solely the files from a directory named `folder`.

Packer does not support user-defined blocks and so only the blocks built in to
the language are available for use. The documentation includes all of the available built-in HCL2 blocks.

## Configuration examples

`@include 'from-1.5/variables/foo-block.mdx'`

- [Variable block documentation](/packer/docs/templates/hcl_templates/blocks/variable).

`@include 'from-1.5/locals/example-block.mdx'`

- [Locals block documentation](/packer/docs/templates/hcl_templates/blocks/locals).

`@include 'from-1.5/sources/example-block.mdx'`

- [source block documentation](/packer/docs/templates/hcl_templates/blocks/source).

`@include 'from-1.5/builds/example-block.mdx'`

- [build block documentation](/packer/docs/templates/hcl_templates/blocks/build).

`@include 'from-1.5/datasources/example-block.mdx'`

- [data block documentation](/packer/docs/templates/hcl_templates/blocks/data).
