The documentation page for the Artifice post-processor states that post-processors can be chained together.
The example code is JSON - is there a way to chain in HCL?
Hi @russauld,
You’re right the artifice examples are JSON, it’s something we should amend to also have working HCL examples for this, thanks for pointing it out.
Chaining in an HCL build will work essentially the same as with JSON, all the provisioners and post-processors you define in a build block are chained after one another.
For example if we translate the artifice example, this would look like:
source "vmware-vmx" "build" {
source_path = "/opt/ubuntu-1404-vmware.vmx"
ssh_username = "vagrant"
ssh_password = "vagrant"
shutdown_command = "sudo shutdown -h now"
headless = true
skip_compaction = true
}
build {
sources = ["vmware-vmx.build"]
provisioner "shell" {
inline = [
"sudo apt-get install -y python-pip",
"sudo pip install ifs",
"sudo ifs install consul --version=0.5.2",
]
}
[...]
post-processor "artifice" {
files = ["consul"]
}
post-processor "compress" {
output = "consul-0.5.2.tar.gz"
}
post-processor "shell-local" {
inline = ["/usr/local/bin/aws s3 cp consul-0.5.2.tar.gz s3://<s3 path>"]
}
}
In this case, the artifacts will be passed on to the next post-processor for them to work on