mirror of https://github.com/hashicorp/packer
Add error-cleanup-provisioner to HCL2 (#10604)
parent
fd8e76636a
commit
774c5903f6
@ -0,0 +1,34 @@
|
||||
# This file was autogenerated by the 'packer hcl2_upgrade' command. We
|
||||
# recommend double checking that everything is correct before going forward. We
|
||||
# also recommend treating this file as disposable. The HCL2 blocks in this
|
||||
# file can be moved to other files. For example, the variable blocks could be
|
||||
# moved to their own 'variables.pkr.hcl' file, etc. Those files need to be
|
||||
# suffixed with '.pkr.hcl' to be visible to Packer. To use multiple files at
|
||||
# once they also need to be in the same folder. 'packer inspect folder/'
|
||||
# will describe to you what is in that folder.
|
||||
|
||||
# Avoid mixing go templating calls ( for example ```{{ upper(`string`) }}``` )
|
||||
# and HCL2 calls (for example '${ var.string_value_example }' ). They won't be
|
||||
# executed together and the outcome will be unknown.
|
||||
|
||||
# source blocks are generated from your builders; a source can be referenced in
|
||||
# build blocks. A build block runs provisioner and post-processors on a
|
||||
# source. Read the documentation for source blocks here:
|
||||
# https://www.packer.io/docs/templates/hcl_templates/blocks/source
|
||||
source "null" "autogenerated_1" {
|
||||
communicator = "none"
|
||||
}
|
||||
|
||||
# a build block invokes sources and runs provisioning steps on them. The
|
||||
# documentation for build blocks can be found here:
|
||||
# https://www.packer.io/docs/templates/hcl_templates/blocks/build
|
||||
build {
|
||||
sources = ["source.null.autogenerated_1"]
|
||||
|
||||
provisioner "shell-local" {
|
||||
inline = ["exit 2"]
|
||||
}
|
||||
error-cleanup-provisioner "shell-local" {
|
||||
inline = ["echo 'rubber ducky'> ducky.txt"]
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
{
|
||||
"builders": [
|
||||
{
|
||||
"type": "null",
|
||||
"communicator": "none"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell-local",
|
||||
"inline": ["exit 2"]
|
||||
}
|
||||
],
|
||||
"error-cleanup-provisioner": {
|
||||
"type": "shell-local",
|
||||
"inline": ["echo 'rubber ducky'> ducky.txt"]
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
source "virtualbox-iso" "ubuntu-1204" {
|
||||
}
|
||||
|
||||
// starts resources to provision them.
|
||||
build {
|
||||
sources = [
|
||||
"source.virtualbox-iso.ubuntu-1204"
|
||||
]
|
||||
|
||||
error-cleanup-provisioner "shell-local" {
|
||||
}
|
||||
|
||||
error-cleanup-provisioner "file" {
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue