#6925·atlantis

Expose optional Terraform JSON plan in drift detection responses

Author: melslowCreated Sep 25, 2026Updated Sep 25, 2026
Labelsfeature

Community Note

  • Please vote on this issue by adding a reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Describe the user story

As a consumer of POST /api/drift/detect, I can request human-readable plan_output following #6709. I’d also like Terraform’s machine-readable plan so I can inspect drift programmatically without parsing text output.

Describe the solution you'd like

Add a default-off include_plan_json request field, independent of include_plan_output. When requested, return the full terraform show -json result as a JSON object in each project’s plan_json field. Generate it while the project’s plan execution lock is held.

Return this data only in the immediate detect response, not in stored drift status or webhooks. If a project’s text plan succeeds but JSON cannot be produced, preserve its drift result, omit plan_json, and provide a per-project plan_json_error explaining why.

Describe the drawbacks of your solution

Generating JSON adds a command and can substantially increase response size. Full Terraform plan JSON may contain sensitive values, so it should require an explicit opt-in and be documented accordingly. JSON may be unavailable even after a successful text plan—for example, when remote operations or a custom workflow do not produce a local plan file. Supporting it also adds API fields and per-project error handling to maintain.

Describe alternatives you've considered

  • Parse plan_output: Avoids another command, but text output is intended for humans and is less reliable for programmatic inspection.
  • Read JSON only when a workflow already produces it: Avoids running show, but the default plan workflow does not produce a JSON file. Users would need to change their workflows to benefit.
  • Run show -json after plan execution in the API controller: Keeps plan execution unchanged, but separates JSON generation from the project’s execution lock and environment.