Safeguard
Security Guides•

Can a Terraform saved plan serve as change evidence for an audit?

A saved Terraform plan shows exactly what was approved and applied. Here is how to capture it, protect it, and link it to the change ticket.

Safeguard Security Team
4 min read

Yes, a saved Terraform plan is strong evidence of what a change would do, and applying that same file proves the approved change is what ran. Treat the plan file as sensitive, store it with the pull request, and link it to the approval and the apply log.

What a saved plan gives you

When you run the plan command with the out option, Terraform writes the generated plan to a file. HashiCorp's documentation says you can pass that file to the apply command to execute exactly those planned changes, and describes this two-step flow as intended for automation. For an auditor, that sequence answers the awkward question of whether what was reviewed is what was deployed.

Without a saved plan, a reviewer approves a plan shown in a pull request, and a later apply recalculates against whatever the state is by then. The two can differ.

The evidence chain

StepRecordWhere it lives
Change requestedTicket or PR descriptionIssue tracker or source control
Plan generatedPlan output text and saved plan fileCI artifact store
Change approvedApproving review on the PRSource control
Plan appliedApply log naming the same plan fileCI logs
ResultState version and timestampState backend

Steps to set it up

  1. In CI, run the plan on every pull request and save the file as a build artifact.
  2. Post the human-readable summary as a PR comment so the reviewer sees it.
  3. Use the detailed exit code option so the pipeline can tell empty plans from non-empty ones. Per the documentation, exit code 0 means no changes, 1 means error and 2 means changes are present.
  4. On merge, apply the saved file rather than re-planning. If the plan is stale, the apply should fail and require a new plan and review.
  5. Keep the plan summary, apply log and approval together, indexed by commit hash.

Handle the file as sensitive

HashiCorp warns that saved plan files contain your full configuration and planned values, and that sensitive values are stored in cleartext. So:

  • Restrict who can download CI artifacts.
  • Set a short artifact retention for the raw file, and keep a redacted text summary for evidence.
  • Never attach the raw file to a public ticket.

Remember to check retention limits in your CI system. If artifacts expire after a short window, your audit period may outlast them. Export the summary and apply log to your evidence store.

What to tell the auditor

Describe the flow in your control narrative: plan on PR, review, apply the same plan on merge, log retained. Then show one sample end to end. Be ready to explain what happens for emergency changes made directly in the console, because drift is where auditors look next.

Try it yourself

Click through it at your own pace, or open it full screen. Notice how ongoing checks surface differences after a change, the same idea as watching for drift after apply.

Quick check

Is the plan text enough, or do I need the file?

The text is useful for review. The file is what proves the applied change matched. Keep a redacted summary and, if policy allows, the file for a limited time.

What if someone changes infrastructure in the console?

Detect it with drift checks, record it as an exception, and bring the code back in line.

Safeguard offers policies, gates and guardrails for pull requests, plus compliance and evidence automation to keep the records. Run a free scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.