From 86b8ce8df0fdd4a2b43cc1ae742c8c025df944d1 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Mon, 12 Apr 2021 12:39:27 -0700 Subject: [PATCH] Postprocessor only docs (#10899) * add a note for only/except from cli to the post-processor template section * typo; missing space * Update website/content/docs/templates/hcl_templates/blocks/build/post-processor.mdx Co-authored-by: Wilken Rivera * tweak wording Co-authored-by: Wilken Rivera --- .../hcl_templates/blocks/build/post-processor.mdx | 15 +++++++++++++++ website/content/partials/commands/except.mdx | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/website/content/docs/templates/hcl_templates/blocks/build/post-processor.mdx b/website/content/docs/templates/hcl_templates/blocks/build/post-processor.mdx index f36eb57e2..878e7a982 100644 --- a/website/content/docs/templates/hcl_templates/blocks/build/post-processor.mdx +++ b/website/content/docs/templates/hcl_templates/blocks/build/post-processor.mdx @@ -78,6 +78,21 @@ build { The values within `only` or `except` are _source names_, not builder types. +If you want to exclude certain post-processors when running `packer build` +from the command line, you can do so: + +`packer build --except=checksum mytemplate.pkr.hcl` will not run the checksum +post-processor. This command line exclusion works by referencing post-processor +_name_. By default, the post-processor is named after is its type, as +demonstrated above in the `checksum` example. You can make a post-processor's +name unique by adding a "name" field to each post-processor block. + +While the `-except` flag can be used to filter out post-processors on the +command line, the `-only` flag does not work for post-processors. If you wish +to only run a post-processor for a given source build you must use the +`only=[source]` syntax inside of your hcl templates, as described above. + + ## Build Contextual Variables Packer allows to access connection information and basic instance state diff --git a/website/content/partials/commands/except.mdx b/website/content/partials/commands/except.mdx index b0e444f8a..85941ed58 100644 --- a/website/content/partials/commands/except.mdx +++ b/website/content/partials/commands/except.mdx @@ -4,7 +4,7 @@ `amazon-ebs` or `virtualbox-iso`, unless a specific `name` attribute is specified within the configuration. In HCL2 templates, the "name" is the source block's "name" label, unless an in-build source definition adds the - "name" configuration option.Any post-processor following + "name" configuration option. Any post-processor following a skipped post-processor will not run. Because post-processors can be nested in arrays a different post-processor chain can still run. A post-processor with an empty name will be ignored.