Closed domoran closed 2 years ago
Note: Using the "directory" parameter on the terraform resource to explicitly set the working directory does not help. Using process explorer it seems that the "tmp" environment variable was missing on the packer environment, making the provisioner place temp files inside the SYSTEMROOT directory (C:\Windows). Passing a "TMP=..." variable on the environment works around the problem. So maybe tmp and path should be passed by default inside the environment of the packer build.
Thank you for your report. This seems to be related to https://github.com/toowoxx/terraform-provider-packer/issues/8
Please try the keep_environment
attribute. If you set it to true, all env variables should get passed through.
Fixing #8 fixes #9
Short Description:
when using provisioners under packer and executing the build via terraform, it seems packer uses as a current directory the Windows directory. This leads to an access denied error, when terraform is not invoked with admin access.
My Environment:
Steps to reproduce:
Expected behaviour:
both builds succeed, terraform plugin will pass the current work directory to the invoked packer process.
Observed behaviour:
Provisioner fails with error message:
which shows that the provisioner tries to place the script command file in the C:\Windows directory which needs elevated rights to write to.
I attached the relevant files to the issue.
main.tf bug.pkr.hcl log.txt