hashicorp / hashicorp/setup-terraform
Bug: Wrapper does not forward the exit code correctly
- Dominant language
- JavaScript
- Stars
- 1.6k
- Forks
- 288
- Avg merge
- 23h 21m
- Merged PRs (30d)
- 3
Description
In https://github.com/hashicorp/setup-terraform/blob/3301b9a8289a6e067869d604f5254ccce035a9d4/wrapper/terraform.js#L44-L47 a non-zero exit code is considered a failure. However, if you use `terraform plan -detailed-exitcode` you might be interested in exit code 2. But, since the wrapper just uses `setFailed()` the wrapper exits with 1.
### Steps to reproduce
Have a terraform configuration where you have changes to the terraform state.
Add a github actions step with following configuration
shell: bash {0}
run: |
terraform plan -detailed-exitcode
echo $?
### Expected result
Echo prints `2` to the log.
### Actual result
Echo prints `1` to the log.
### Workaround
Instead of using `bash` to read the exit code, create another step where you check `${{ steps..outputs.exitcode }}`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.