mirror of
https://github.com/hashicorp/packer.git
synced 2026-02-26 19:41:06 -05:00
53 lines
1.4 KiB
Text
53 lines
1.4 KiB
Text
---
|
|
description: >
|
|
The post-processor block defines how a post-processor is configured.
|
|
layout: docs
|
|
page_title: post-processor - build - Blocks
|
|
sidebar_title: <tt>post-processor</tt>
|
|
---
|
|
|
|
# The `post-processor` block
|
|
|
|
`@include 'from-1.5/beta-hcl2-note.mdx'`
|
|
|
|
The `post-processor` block defines how a post-processor is configured.
|
|
|
|
```hcl
|
|
# builds.pkr.hcl
|
|
build {
|
|
# ...
|
|
post-processor "checksum" {
|
|
checksum_types = [ "md5", "sha512" ]
|
|
keep_input_artifact = true
|
|
}
|
|
}
|
|
```
|
|
|
|
Post-processors run after the image is built by the builder and provisioned by
|
|
the provisioner(s). Post-processors are optional, and they can be used to
|
|
upload artifacts, re-package, or more. The list of available post-processors
|
|
can be found in the [post-processors](/docs/post-processors) section.
|
|
|
|
# Run on Specific Builds
|
|
|
|
You can use the `only` or `except` configurations to run a post-processor only
|
|
with specific builds. These two configurations do what you expect: `only` will
|
|
only run the post-processor on the specified builds and `except` will run the
|
|
post-processor on anything other than the specified builds.
|
|
|
|
An example of `only` being used is shown below, but the usage of `except` is
|
|
effectively the same:
|
|
|
|
```hcl
|
|
# builds.pkr.hcl
|
|
build {
|
|
# ...
|
|
post-processor "checksum" {
|
|
checksum_types = [ "md5", "sha512" ]
|
|
keep_input_artifact = true
|
|
only = ["source.amazon-ebs.example"]
|
|
}
|
|
}
|
|
```
|
|
|
|
The values within `only` or `except` are _build names_, not builder types.
|