I have some code which works find when I run it from the Packer root path, but now I’m trying to run it from one directory higher from a bash menu and I’m having issues with my shell provisioner resulting in a “No such file or directory…” message.
My folder structure is:
- menu.sh
- Alma
–files
—file.txt
–scripts
—script1.sh - rocky
–files
—file.txt
–scripts
—script1.sh
The file provisioner works fine with:
Provisioner “file” {
source = “${abspath(path.root)}/files/file1.txt”
destination = “/tmp”
}
provisioner “shell” {
execute_command = local.execute_command
scripts = var.shell_scripts
}
… but I can’t figure out how to use ${abspath(path.root)} or something with my array of scripts. I’m calling the scripts from a var file whereas I have the files hard-coded in the packer file, so I suppose I could do the same with the scripts, but in an ideal world I’d like to put everything in the var file.
Ideas?