I've been using Packer in the context of a Jenkinsfile (using the Pipeline plugin for Jenkins) with success. The only problem is the need to write a JSON file to the local file system that can be passed to Packer.
Is there any sort of functionality that would allow me to execute Packer from a script, and pass a "JSON file", but via memory instead of a local file?
To put more context to the question, in the Jenkinsfile, the call currently looks something like this:
sh "packer build -var-file=variables.json packer.json"
...where the script is executing Packer via shell and is reading a local file that contains the JSON variables.
What I would like to be able to do is along the lines of:
def json_var = unimportant_function_that_generates_json()
sh "packer build -var-file=${json_var} packer.json"
...where a variable is created in the script containing JSON, and the shell call to packer can be passed the variable.
Is anything like this possible? If not, are there any plans in the future to implement a feature similar to this?
Once again we're huge fans of Hashicorp's open source products here at AOL, keep up the good work!!!
Andrew