Hi,
I’m new to packer so probably I’m making some mistake but I cannot find it.
I’m trying to understand how I can run specific provisioners on specific builds.
I tried to use the “only” directive (as explained at provisioner - build - Blocks | Packer by HashiCorp) but the result is that no provisioner is executed.
My code looks almost like this:
source “amazon-ebs” “AMI-ubuntu1” {
communicator = “ssh”
…
}
source “amazon-ebs” “AMI-ubuntu2” {
communicator = “ssh”
…
}
build {
name = “Build-AMI-ubuntu1-and-2”
sources = [
“source.amazon-ebs.AMI-ubuntu1”,
“source.amazon-ebs.AMI-ubuntu2”
]
provisioner “shell” {
only = [“source.amazon-ebs.AMI-ubuntu1”]
inline = […]
}
provisioner “shell” {
only = [“source.amazon-ebs.AMI-ubuntu2”]
inline = […]
}
}
Any help would be appreciated
Kind regards
Stefano