-
Notifications
You must be signed in to change notification settings - Fork 249
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
Plan with -detailed-exitcode option returns error #152
Comments
That's not related to If you do not need to process the detailed exit code, then just omit the parameter. If you want to do different things based on the exit code, then you are in the same situation as I am currently. So far I haven't found a workaround to retrieve the detailed exit code but do not let the script stop immedialty. |
I were wrong. It is in indeed related as it seems that - run: |
terraform plan -out ${{ inputs.terraform-plan-artifact-name }} -detailed-exitcode || true so bash counts it as exit code 0 and the step is also finishing successfully. It still prints the error to log and build summary page |
Hi together, set +e
terraform plan ${{ inputs.TF_VARS }} -detailed-exitcode -out=deploy_${{ github.run_number }}.tfplan ${{ steps.SetTerraformDestroyFlag.outputs.destroyFlag }}
exitcode=$?
if [[ $exitcode -eq 2 ]]; then
echo '::set-output name=planHasChanges::true'
exit 0
else
exit $exitcode
fi This works fine when using an ubuntu runner without the TF setup action. - uses: hashicorp/setup-terraform@v1
name: Setup Terraform on private runner Of course, I can use |
This is an issue that comes from @actions/core function. hashicorp/setup-terraform provides the terraform(1) wrapper and it uses Line 9 in 8b4c280
We can obtain correct exit code from terraform(1) to specify |
Hi @aereal, how do we get |
You may be able to set those values using workflow commands. steps:
- id: terraform
run: |
set +e # allow the workflow to continue following steps even if the `terraform` execution failed
terraform ... 1>stdout 2>stderr
tf_exitcode=$?
echo "::set-output name=exitcode::$tf_exitcode"
echo "::set-output name=stdout::$(cat ./stdout)"
echo "::set-output name=stderr::$(cat ./stderr)" (I'm not sure using |
Thanks for your help @aereal, really appreciate it. |
@aereal unfortunately seems like |
@jpogran looks like it has solved the issue, no more errors and I can still get the proper exitcode, thanks. |
any word as to when 2.1.0 will be released? |
Hoping for 2.1.0 soon too, this is really confusing to our users. |
Closing this issue as it seems the fix was released in |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Hi,
Running plan with -detailed-exitcode reports error. Thanks.
The text was updated successfully, but these errors were encountered: