-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.