Hello everyone,
I started using packer recently and so far faced an issue with passing
variables while using shell provisioner.
The following example was running on Packer 0.11.0 on Ubuntu16.04 and it
was provisioning CentOS 6.7 host.
Here is an example of my code:
"variables": {
"aws_access_key": "",
"aws_secret_key": ""
}
"provisioners": [
{
"type": "shell",
"environment_vars":[
"PACKER_SERVERNAME=packer_test",
"AWS_ACCESS_KEY_ID={{user `aws_access_key`}}",
"AWS_SECRET_ACCESS_KEY={{user `aws_secret_key`}}"
],
"inline": [
"echo AWS_ACCESS_KEY_ID is $AWS_ACCESS_KEY_ID",
"echo '{{user `aws_access_key`}}' > /tmp/aws_access_key",
"sudo bash packer_bootstrap.sh"
]
}]
So, here I'm defining environment variables directly for *PACKER_SERVERNAME*
and using hiding method for *AWS_ACCESS_KEY*.
However upon checking this variable value during the next step in "inline"
command - there is nothing in it.
Its output is just like that:
*==> amazon-ebs: Provisioning with shell script: /tmp/packer-shell656434894*
* amazon-ebs: AWS_ACCESS_KEY_ID is*
And /tmp/aws_access_key file is also empty.
Would you please advice what is wrong in that configuration, why variables
aren't going through and how to make it working.
Thank you,
Maxim
--
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/e66ad4bf-76be-40ac-9d13-67cd4b930010%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.