2
-detailed-exitcode - Return a detailed exit code when the command exits. When provided, this argument changes the exit codes and their meanings to provide more granular information about what the resulting plan contains:

0 = Succeeded with empty diff (no changes)
1 = Error
2 = Succeeded with non-empty diff (changes present)

When I try to use terragrunt plan -detailed-exitcode I am getting error and my script is not proceeding.

It seems the error is there only when plan detects there is a change. If there is no change ( exit status 0 ), the script doesn't stop/exit. The workaround so far is to run terragrunt plan > out.txt ( without the -detailed-exitcode ) and then parse out.txt to see if any changes are there and take according action.

Surd
  • 21
  • 3
  • Do you have some more context for what you're trying to do here? `-detailed-exitcode` is doing what it says it does which is to exit with a non zero status on a plan with a diff. If you are running this in some CI systems or as part of a shell script with `set -e` then things won't proceed as they are designed to exit on those errors. You can work around that if needed but it would be useful to know how you are calling it and what you plan to do afterwards. – ydaetskcoR Apr 27 '21 at 16:20
  • 1
    Hi, I had logged the same issue in https://github.com/gruntwork-io/terragrunt/issues/1470#issuecomment-754167635 where you can find latest updates. – Surd Apr 29 '21 at 08:29

0 Answers0