Reader small image

You're reading from  HashiCorp Packer in Production

Product typeBook
Published inJul 2023
PublisherPackt
ISBN-139781803246857
Edition1st Edition
Right arrow
Author (1)
John Boero
John Boero
author image
John Boero

John Boero has 20 years of experience in the tech industry covering engineering, consulting, architecture, and pre-sales. He comes from Chicago, IL in the USA but currently lives in London, UK. He has worked for Red Hat, Puppet, and HashiCorp and remains active in the open source community. All commissions for this book will be donated to the Raspberry Pi Foundation non-profit to encourage coding and computing skills for kids.
Read more about John Boero

Right arrow

Controlling flow and using breakpoints

We may also need Packer to pause before continuing part of a build. Remember—by default, an error will cause Packer to destroy the environment, which unfortunately makes it hard for troubleshooting what went wrong. Rather than debugging through a build step by step, we can do some basic options to have Packer stop where we want it to.

First and foremost is the -on-error option. This can have one of four values. By default, it is set to cleanup, which explains why Packer deletes the build environment after errors. Again, as per the Packer documents, it may be helpful to set it to one of the following instead:

  • abort: Exits without cleanup.
  • ask: Prompts and waits for you to decide to clean up, abort, or retry the failed step.
  • cleanup (default): Exits with cleanup. This is the default.
  • run-cleanup-provisioner: Aborts with the error-cleanup-provisioner if one is defined.

If running Packer interactively, the ask...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
HashiCorp Packer in Production
Published in: Jul 2023Publisher: PacktISBN-13: 9781803246857

Author (1)

author image
John Boero

John Boero has 20 years of experience in the tech industry covering engineering, consulting, architecture, and pre-sales. He comes from Chicago, IL in the USA but currently lives in London, UK. He has worked for Red Hat, Puppet, and HashiCorp and remains active in the open source community. All commissions for this book will be donated to the Raspberry Pi Foundation non-profit to encourage coding and computing skills for kids.
Read more about John Boero