Terraform apply exit code on error I'm using Terraform as part of a Jenkins Pipeline. When terraform apply encounters an error, it does not return a non-zero exit code. When running into a problem on Jenkins, it does not stop the pipeline or mark the build as FAILURE.

If terraform encounters an error, I need the job to stop and not progress. 

Looking at the docs for apply, it doesn't look like I can provide a flag to return helpful exit codes. The docs for plan has a -detailed-exitcode flag, but doesn't look like that'll help me.
Turns out this was not a real issue. My apologies. At the end of that shell script, it did an echo which is what was returning the non-zero status code. After I took that out, it worked as expected.