Your CI pipeline runs `terraform plan` on every pull request and posts the output as a comment. A `terraform plan` exits with code 2. What does this mean?

Direct Answer (Verified)Reviewed by Sunny (Senior Cloud Engineer)

Correct Answer: The plan succeeded and changes are pending

Terraform's exit codes: **0** = success, no changes; **1** = error; **2** = success, changes pending (diff exists). CI systems must check for exit code 2 to detect pending infrastr...

Real Exam Scenario

Your CI pipeline runs `terraform plan` on every pull request and posts the output as a comment. A `terraform plan` exits with code 2. What does this mean?

✓ Correct Answer & Explanation

Correct Answer

The plan succeeded and changes are pending

Why This Answer Is Correct

Terraform's exit codes: **0** = success, no changes; **1** = error; **2** = success, changes pending (diff exists). CI systems must check for exit code 2 to detect pending infrastructure changes. Using `-detailed-exitcode` flag enables this three-way exit code behavior. Without it, Terraform exits 0 for both "no changes" and "changes pending".