toowoxx / terraform-provider-packer

Terraform Provider for HashiCorp Packer
Mozilla Public License 2.0
32 stars 7 forks source link

Failed to run packer init: could not create temporary file to dowload plugin #5

Closed oliedenyercaa closed 2 years ago

oliedenyercaa commented 2 years ago

Hi there,

Thanks very much for sharing this provider, it will fit very well with our use case.

Getting the following error during packer init phase:

╷ │ Error: Failed to run packer init │ │ with packer_image.win10_vd_base, │ on main.tf line 65, in resource "packer_image" "win10_vd_base": │ 65: resource "packer_image" "win10_vd_base" { │ │ could not run packer command; output: Failed getting the "github.com/rgl/windows-update" plugin: │ 1 error occurred: │ * could not create temporary file to dowload plugin: open C:\WINDOWS\packer-plugin-860832368.zip: Access is denied. │ │ │ : exit status 1 ╵

Terraform version details: Terraform v1.0.11 on windows_amd64

Packer version details: Packer v1.7.8

OS Version: Edition: Windows 10 Enterprise Version: 20H2 Build: 19042.1466

Running packer init outside of the provider works without issues, with plugins downloaded to %USERPROFILE%/packer.d/plugins/github.com/rgl/windows-update.

I have tried an environment variable for PACKER_PLUGIN_PATH, both locally and by using the environment option but same issue.

Any suggestions? Apologies in advance if this is down to something basic, I am just starting out with Packer and this provider.

simaotwx commented 2 years ago

Hi there,

thank you very much for your feedback. I think I'm seeing what the issue could be here. Did you specify the keep_environment argument? See here and here for reference.

I'm guessing that the USERPROFILE and USERNAME variables are not getting passed through to Packer.

oliedenyercaa commented 2 years ago

Appreciate the swift reply. That's solved it.

simaotwx commented 2 years ago

Awesome, glad it helped :)