The env_var_file described in the docs won't do what you want. It is
created by Packer from the env vars that you supply to environment_vars.
It's just writing the environment vars to a file and dot-sourcing that
file, rather than declaring the variables inline. It's intended to help
people work around difficulties escaping special characters.
You can't currently modify it to add your own vars separately from what you
add to environment_vars.
Your best bet is to use the file provisioner to upload your own var file
and then either dot-source it from within your shell script or dot-source
it in the execute_command. For example, maybe you can change the
execute_command to:
"execute_command": "chmod +x {{ .Path }}; . tmp/.myenvvarfile sudo {{ .Path
}}",
Where you previously uploaded .myenvvarfile to tmp.
(Note, I haven't tested this but in theory it should work)
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/CAGPV1uoHOi7pEfhXbQNCGhLrmLwtVgP4G85BUPnE-OnadQ5oHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.