-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)
当我尝试使用 terragrunt plan -detailed-exitcode 时出现错误并且我的脚本没有继续。
似乎只有当计划检测到有变化时才会出现错误。如果没有变化(退出状态 0),脚本不会停止/退出。到目前为止的解决方法是运行 terragrunt plan > out.txt (不带 -detailed-exitcode ),然后解析 out.txt 以查看是否存在任何更改并采取相应的措施。