Terraform Build Passing Errantly

Terraform Build Passing when it should be Failing

If you're operating Terraform within a wrapper shell script, you would usually need to pass an unsuccessful exit status onto its caller. Please be aware that this action isn't the default behavior.

In the case of Bash, you can configure it to recognize an error in a command as a failure of the whole script itself. To achieve this, you need to include the following line of code before running the Terraform command:

set -e


As another option, you can design logic to explicitly track the exit status. By employing the exit command, you can pass an unsuccessful code to the outcome of the shell script.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.