terraform show
The command that prints the current state, or the contents of a saved plan file, in readable or JSON form.
In more detail
After a destroy, terraform show reports that the state is empty. With -json and a plan file it produces the machine-readable plan that policy tools such as OPA evaluate.
Example
terraform show -json tfplan > plan.jsonRelated terms
- saved plan — A plan written to a file with -out, which terraform apply can later carry out exactly as reviewed.
- Terraform state — Terraform's record, usually a JSON file called terraform.tfstate, mapping each resource in the configuration to the real object it created.
- JSON plan representation — The machine-readable form of a saved plan, produced by terraform show -json, which lists every planned change and value.
Taught in
- Enforcing OPA Guardrails on Terraform Plan Payloads — Cloud Security & DevSecOps Engineering
- Predicting Changes, Then Applying Them — Infrastructure as Code with Terraform
- Tearing It Down With Destroy — Infrastructure as Code with Terraform
- Policy As Code With OPA — Infrastructure as Code with Terraform
- State: Terraform's Memory Of What It Built — HashiCorp Terraform Associate (004) Exam Prep
- Reading A Plan, Saving It, Applying It — HashiCorp Terraform Associate (004) Exam Prep
- Validate, Format, Destroy, And The Flags That Bend A Plan — HashiCorp Terraform Associate (004) Exam Prep
- Drift: When Reality Stops Matching State — HashiCorp Terraform Associate (004) Exam Prep
- Inspecting And Repairing State From The CLI — HashiCorp Terraform Associate (004) Exam Prep
- Collaboration And Governance: Teams, Policies, Registry And Health — HashiCorp Terraform Associate (004) Exam Prep
- The Full Mock: Sixty Minutes, Eight Areas, One Plan For The Last Week — HashiCorp Terraform Associate (004) Exam Prep