feat(action): Support detailed exit codes.

This should allow plans to succeed using the terraform_wrapper functionality whenever an exit code of 2 is returned.
https://www.terraform.io/docs/cli/commands/plan.html#detailed-exitcode

- This is useful for adding custom steps in our GitHub action workflows.
- Not a Javascript developer so Im not sure how valid the OR condition is.
This commit is contained in:
Yordan Ibishev 2021-07-13 17:54:25 +01:00 committed by James Pogran
parent f76ce99249
commit 4e5d7569e5

View file

@ -42,7 +42,8 @@ async function checkTerraform () {
core.setOutput('exitcode', exitCode.toString(10));
// A non-zero exitCode is considered an error
if (exitCode !== 0) {
// An exit-code 2 is used when the '-detailed-exitcode' option is passed to plan. this denotes Success with non-empty diff (changes present)
if (exitCode !== 0 || exitCode !== 2 ) {
core.setFailed(`Terraform exited with code ${exitCode}.`);
}
})();