As you can see here my whole set up:
https://groups.google.com/forum/#!topic/packer-tool/WQEXIut-ibI
The issue with this is that i have too many variables (lets say 40) and packer json would be too crowded.
{
"type": "shell",
"script": "./example.sh",
"environment_vars": [
"AWS_ACCESS_KEY={{user `script_aws_access`}}",
"AWS_SECRET_ACCESS_KEY={{user `script_aws_secret_access`}}",
"VPN_01_PUBLIC_IP={{user `vpn_01_public_ip`}}",
"VPN_01_PRIVATE_IP={{user `vpn_01_private_ip`}}"
5
6
7
8
9
10
etc
],
"pause_before": "10s"
}
Is there a way to hold non sensitive variables in separate file?
I was thinking something like this:
{
"type": "shell",
"script": "./example.sh",
"use_env_var_file": true,
"execute_command": "chmod +x {{ .Path }}; {{ .EnvVarFile }} sudo -E sh '{{ .Path }}'",
"environment_vars": [
"AWS_ACCESS_KEY={{user `script_aws_access`}}",
"AWS_SECRET_ACCESS_KEY={{user `script_aws_secret_access`}}",
"pause_before": "10s"
}
So the point is to use "environment_vars" for AWS keys and other secrets, and VarFile for other non sensitive values.
1. How this can be achieved?
2 . Where we can set .EnvVarFile variable? How packer knows the path to the Var file?
3. .Path ( in this case packer knows where is example.sh, right?