Interview Prep/Terraform/Workflow and Providers

Your manager asks why we bother with `terraform plan` when `apply` shows the same diff before asking for confirmation. What do you say?

BeginnerScenarioWorkflow and Providers
Answer

Situation read → A fair question; interactive apply does print a plan, but it re-computes it at that moment.

What I'd do →

  1. Run terraform plan -out=tfplan in the PR pipeline and attach the human-readable output to the PR.
  2. After approval, run terraform apply tfplan which applies exactly that artifact.

Why → A separate plan lets reviewers approve a concrete diff, and a saved plan fails if state changed in between (stale plan). Interactive apply re-plans, so the diff you approved could differ from what runs.

Interview tip → Mention that plan files can contain secrets, so treat the artifact as sensitive.

All Terraform questions Roadmap: Terraform

More on Workflow and Providers