Back to Packer

`breakpoint` provisioner

website/content/docs/provisioners/breakpoint.mdx

1.15.32.6 KB
Original Source

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

[!IMPORTANT]
Documentation Update: Product documentation previously located in /website has moved to the hashicorp/web-unified-docs repository, where all product documentation is now centralized. Please make contributions directly to web-unified-docs, since changes to /website in this repository will not appear on developer.hashicorp.com. ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

<BadgesHeader> <PluginBadge type="official" /> </BadgesHeader>

breakpoint provisioner

The breakpoint provisioner pauses the build operation until you press the Enter key to resume the build. Use the breakpoint provisioner to help you debug errors.

Alternatively, you can add the -debug flag when running your build to halt the operation at every step and between every provisioner.

Basic Example

<Tabs> <Tab heading="HCL2">
hcl
source "null" "example" {
  communicator = "none"
}

build {
  sources = ["source.null.example"]

  provisioner "shell-local" {
    inline = ["echo hi"]
  }
  provisioner "breakpoint" {
    disable = false
    note    = "this is a breakpoint"
  }
  provisioner "shell-local" {
    inline = ["echo hi 2"]
  }
}
</Tab> <Tab heading="JSON">
json
{
  "builders": [
    {
      "type": "null",
      "communicator": "none"
    }
  ],
  "provisioners": [
    {
      "type": "shell-local",
      "inline": "echo hi"
    },
    {
      "type": "breakpoint",
      "disable": false,
      "note": "this is a breakpoint"
    },
    {
      "type": "shell-local",
      "inline": "echo hi 2"
    }
  ]
}
</Tab> </Tabs>

Configuration Reference

Optional

  • disable (boolean) - If true, skip the breakpoint. Useful for when you have set multiple breakpoints and want to toggle them off or on. Default: false

  • note (string) - a string to include explaining the purpose or location of the breakpoint. For example, you may find it useful to number your breakpoints or label them with information about where in the build they occur

@include 'provisioners/common-config.mdx'

Usage

Insert this provisioner wherever you want the build to pause. You'll see ui output prompting you to press "enter" to continue the build when you are ready.

For example:

shell-session
==> docker: Pausing at breakpoint provisioner with note "foo bar baz".
==> docker: Press enter to continue.

Once you press enter, the build will resume and run normally until it either completes or errors.