Skip to content

fix(terraform): exit non-zero on drift or failed check - #7193

Merged
dan-petty merged 1 commit into
mainfrom
fix/5319-tf-drift-exit-code
Nov 25, 2026
Merged

dan-petty merged 1 commit into
mainfrom
fix/5319-tf-drift-exit-code

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Run devops tf drift with -refresh-only -detailed-exitcode -lock=false -out=<plan> in a temporary directory and read resource_drift and top-level checks from tofu show -json <plan>.

  • read_plan_drift returns PlanDriftResult (drifted, failed_checks, unknown_checks, plan_returncode, plan_error) and skips tofu show on plan failures.
  • devops tf drift exits 1 on plan errors or fail/error/unknown check results (overriding drift), 2 on drift across table and serialized formats, and 0 when clean or uninitialized.
  • Help text and docs/commands/tf.md document exit codes 0, 1, and 2.

Verified locally: all 29/29 static/lint/type/docs/openspec gates pass and 327 targeted tests pass (191 with coverage: models/tf.py 100%, commands/tf.py 89%, tf/analysis.py 91%).

Closes #5319

Change: openspec/changes/archive/2026-11-25-5319-tf-drift-exit-code/

@dan-petty
dan-petty marked this pull request as ready for review November 25, 2026 16:52
@dan-petty
dan-petty merged commit f24cfc2 into main Nov 25, 2026
42 of 45 checks passed
@dan-petty
dan-petty deleted the fix/5319-tf-drift-exit-code branch November 25, 2026 16:53
dan-petty-release Bot added a commit that referenced this pull request Nov 25, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.220.0](v0.219.0...v0.220.0)
(2026-11-25)


### Features

* **ai:** enforce gateway first-token timeout
([#6000](#6000))
([#7198](#7198))
([af6958c](af6958c))
* **github:** request dan-petty and automerge all PRs
([#7195](#7195))
([681c6c3](681c6c3))


### Bug Fixes

* **ci:** check ADDED/MODIFIED requirement length
([#5378](#5378))
([#7194](#7194))
([4712043](4712043))
* **ci:** run single-module narrowed tests serially
([#5612](#5612))
([#7196](#7196))
([7b3289c](7b3289c))
* **config:** refuse typesafe/jev-router as decision model
([#6361](#6361))
([#7197](#7197))
([46777dd](46777dd))
* **terraform:** exit non-zero on drift or failed check
([#7193](#7193))
([f24cfc2](f24cfc2)),
closes [#5319](#5319)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(tf): devops tf drift exits non-zero on drift or a failed check

1 participant