Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action hangs with terraform_wrapper: true when variables aren't defined #150

Open
jorupp opened this issue Feb 22, 2022 · 1 comment
Open
Labels
bug Something isn't working

Comments

@jorupp
Copy link

jorupp commented Feb 22, 2022

I was following https://learn.hashicorp.com/tutorials/terraform/github-actions, but forgot to prefix my environment variables with TF_VAR_, so they weren't being populated, causing terraform plan to prompt for them at runtime. However, with terraform_wrapper: true (the default), the terraform plan just ran for a while (I killed it after 10 minutes) without exiting. Once I disabled the wrapper, it exited with an error in a second. Based on that message, I was able to find and fix my error, and with that fixed, it worked with the wrapper again.

I wonder if terraform plan when run with the wrapper is waiting for an input that will never come to it's "enter a value for the variable" prompt? If so, I wonder if the fix involves passing an empty input to @actions/exec.exec?

const options = {
listeners,
ignoreReturnCode: true
};
const exitCode = await exec(pathToCLI, args, options);

@jorupp
Copy link
Author

jorupp commented Feb 23, 2022

Repro: https://github.com/jorupp/terraform-wrapper-test

Wrapper disabled, variable not defined

https://github.com/jorupp/terraform-wrapper-test/actions/runs/1888449826
Fails with:

The root module input variable "TEST_VALUE" is not set, and has no default
value. Use a -var or -var-file command line argument to provide a value for
this variable.
  Enter a value: 

Wrapper enabled, variable defined

https://github.com/jorupp/terraform-wrapper-test/actions/runs/1888449906

Succeeds

Wrapper enabled, variable not defined

https://github.com/jorupp/terraform-wrapper-test/actions/runs/1888450051

terraform plan ran for 20 minutes before I killed it.

@ksatirli ksatirli added the bug Something isn't working label Apr 4, 2022
hellais added a commit to ooni/devops that referenced this issue Feb 2, 2024
hellais added a commit to ooni/devops that referenced this issue Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants