Terraform / Modules and state-aware lifecycle / Lesson 14
Review machine-readable Terraform plans safely
Interpret plan actions and unknown values while protecting sensitive JSON artifacts.
On this page
Lesson goals
- Distinguish planned actions from applied outcomes.
- Recognize unknown and sensitive plan values.
- Design a restricted review and retention process.
- Interpret action sequences and unknown values without claiming execution.
- Protect structured plan artifacts and bind review to exact context.
Read a plan as a proposal
A Terraform plan describes proposed changes for a particular configuration, state and provider context. Machine-readable JSON can help automation inspect actions, but a successful parser does not authorize the changes. Review the target workspace, configuration revision and plan generation context alongside the artifact. The examples are synthetic records, not output from a Terraform run.
Interpret actions and unknowns
The first record proposes an update while output remains unknown. It proves neither success nor the final output. Real plan JSON has documented change and unknown representations; use that format and its version information rather than this simplified record as a parser fixture.
resource: terraform_data.example
actions: ["update"]
unknown_fields: ["output"]
The record separates a proposed action from an unknown value; it is not a real plan.
Protect the artifact
Terraform plan and state can contain sensitive data. The JSON form produced by terraform show can expose sensitive values in plaintext, even when ordinary display redacts them. Restrict artifact access, avoid copying content into logs and set an approved retention period. The second record proposes a classification and named audience; it does not implement access control.
artifact: synthetic-plan.json
classification: sensitive
retention: approved-short-window
access: named-reviewers
This checklist names handling decisions; it creates no file or permission.
Review context and change
Compare proposed actions with the request and expected resource addresses. Investigate unknowns and provider changes. A saved plan is tied to its context; changed configuration or state can invalidate earlier review. Never hide fields merely to pass a check.
Verify without exposing secrets
In an isolated lab, verify that reviewers can identify target, actions and unknowns, and that unauthorized users cannot retrieve the artifact. Record results without dumping JSON. Repeat review if the plan changes; parsing does not prove apply or service health.
Read structured output as a proposal
A machine-readable Terraform plan represents a proposed change in a defined configuration, state and input context. It does not prove that an apply succeeded or that the final infrastructure exists. Interpret each resource address and its action sequence, including replacement represented by deletion and creation, before summarizing risk. Keep proposed, applied and observed states separate. The records below are synthetic summaries rather than full Terraform JSON output; they do not run Terraform or alter infrastructure.
For example, a JSON summary may identify an update on one address and a replacement on another. The summary helps locate the relevant records, but the reviewer still needs the full context and the data owner’s assessment of the replacement. Record which fields are unknown and which actions are proposed. Do not transform a machine-readable action into a statement that the provider already performed it.
Preserve unknowns and action meaning
A planned value can be unknown until a later operation. Report the action that is known and the value that remains unknown instead of inventing a final endpoint or treating unknown as null. An update action does not prove the provider will succeed; a delete-and-create sequence deserves its own identity, data and availability review. Read the documented JSON format and relevant version rather than assuming a simplified example covers every resource change or nested field.
A reviewer should distinguish the action array from fields that describe before and after values, unknown portions and sensitivity. Consult the documented format for the Terraform version in use and avoid building a parser around one simplified example. If a field is absent or its meaning is not understood, record that limitation rather than silently treating it as false or empty. Replacement ordering and resource-specific behavior still need the exact plan and provider context.
Treat the artifact as sensitive
Machine-readable plans can contain sensitive values and detailed infrastructure information. A reviewer’s ability to read a file does not by itself establish authorization to retain, copy or share it. Use approved storage, access, logging and retention controls, and avoid pasting raw artifacts into tickets or public channels. Share a sanitized summary with the exact address and action when appropriate. Sensitivity indicators in an output are not a substitute for protecting the full artifact and state.
Define who may download, store and delete a plan artifact and how long it is retained. A sanitized summary should preserve the resource address, action and uncertainty needed for a decision without copying secrets. If a raw artifact is exposed, follow the organization’s incident process rather than assuming a sensitivity flag revoked access.
Bind interpretation to the reviewed context
Record Terraform and provider versions, configuration revision, variables, backend, workspace, target and artifact time along with the plan. A plan for development does not establish the production proposal. If inputs, configuration or relevant state change, reassess the artifact and follow the documented workflow for a current plan. Approval of one artifact does not authorize an unrelated target. A no-change result covers the workflow’s managed scope; it does not prove that every security requirement is present or every unmanaged resource is correct.
Verify execution and user behavior independently
An approved plan still needs an authorized apply and observation before a change can be reported as completed. An apply can fail after partial effects, so inspect actual state and remote resources before an authorized retry. Test the representative application operation and recovery separately from plan parsing. Record sanitized results, exact scope and time; a blocked test is unverified. A local parser can classify an illustrative action sequence but cannot prove provider behavior, remote authorization or application readiness.
Keep the original artifact in controlled storage and link the sanitized review to its version, target and time. If a parser or test environment is unavailable, assign an owner and record the gap rather than reporting an unobserved failure. After an authorized apply, inspect actual state and test a representative user operation. These separate observations let a reviewer distinguish parsing accuracy from execution and operational outcome.
20 worked examples
1. Update with unknown
Problem: What is known from this synthetic record?
- The update is proposed and the endpoint is not yet determined.
- Report the proposed update and unknown endpoint; do not claim apply success.
address=example.service
actions=["update"]
endpoint=unknown
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Report the proposed update and unknown endpoint; do not claim apply success.
Why this result follows: A plan action and an unknown value describe different facts.
2. Replacement sequence
Problem: Are these actions an in-place update?
- The action sequence includes deletion and creation rather than an update.
- Treat it as a replacement proposal and review data and availability.
address=example.database
actions=["delete","create"]
data impact=not reviewed
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Treat it as a replacement proposal and review data and availability.
Why this result follows: The action sequence determines the proposed lifecycle category in this fixture.
3. No-op scope
Problem: Does this no-op prove an omitted logging control exists?
- The record says no action for the represented object but does not establish logging.
- Review the logging requirement and actual managed scope separately.
actions=["no-op"]
logging requirement=not represented in fixture
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Review the logging requirement and actual managed scope separately.
Why this result follows: A no-op for one address is not proof of design completeness.
4. Sensitive artifact
Problem: Should the raw plan be pasted into a public ticket?
- The raw artifact contains more sensitive information than the summary needs.
- Use controlled storage and a sanitized summary; follow exposure procedures if disclosed.
plan contains=sensitive fields
ticket=public
needed evidence=action summary
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Use controlled storage and a sanitized summary; follow exposure procedures if disclosed.
Why this result follows: Structured output can contain sensitive values.
5. Wrong target
Problem: Does a dev plan authorize a production change?
- The reviewed context differs from the intended target.
- Review the correct production artifact and authorization.
plan workspace=dev
intended target=prod
approval=dev
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Review the correct production artifact and authorization.
Why this result follows: A plan and approval are scoped to their target and inputs.
6. Unknown versus null
Problem: Does an unknown endpoint mean null?
- The record says the value is not yet determined, not that it is null.
- Keep the endpoint unknown until appropriate evidence exists.
planned endpoint=unknown
final value=not observed
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Keep the endpoint unknown until appropriate evidence exists.
Why this result follows: Unknown and null carry different meanings.
7. Plan versus apply
Problem: Does an approved plan prove apply completed?
- No execution or resulting remote state is recorded.
- Keep the change unverified.
plan=approved
apply=not run
remote state=not inspected
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Keep the change unverified.
Why this result follows: Approval of a proposal is not an observed apply.
8. Partial failure
Problem: Does an apply error prove no resource changed?
- The fixture records a completed change before the error.
- Inspect actual state and remote effects before an authorized retry.
apply=failed
resource-A=changed
resource-B=unknown
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Inspect actual state and remote effects before an authorized retry.
Why this result follows: A multi-step apply can leave partial effects.
9. Parser scope
Problem: Does a local action counter prove provider behavior?
- The local counter classifies supplied text but did not exercise a provider.
- Keep provider and remote behavior unverified.
synthetic parser result=one update
provider plan=not run
remote target=not accessed
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Keep provider and remote behavior unverified.
Why this result follows: Parsing a fixture is not a cloud operation.
10. Blocked review test
Problem: Does an unavailable artifact prove the plan has no changes?
- No plan was parsed in the fixture.
- Record the review as blocked and keep its actions unknown.
artifact=unavailable
parser run=no
result=none
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Record the review as blocked and keep its actions unknown.
Why this result follows: An uninspected artifact cannot establish its contents.
11. Create proposal
Problem: Does this action prove the object exists?
- The structured record proposes creation but contains no apply result.
- Keep object existence unverified until authorized remote evidence is available.
address=example.bucket
actions=["create"]
apply=not observed
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Keep object existence unverified until authorized remote evidence is available.
Why this result follows: A proposed create is not an observed remote object.
12. Delete proposal
Problem: What risk should this action prompt?
- The proposed deletion affects records while protection and recovery are unreviewed.
- Hold implementation for data owner, retention and recovery review.
address=example.records
actions=["delete"]
retention=unknown
backup test=not run
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Hold implementation for data owner, retention and recovery review.
Why this result follows: A machine-readable action does not establish that data is disposable.
13. Reverse replacement order
Problem: Does this sequence still describe replacement in the model?
- The record contains creation and deletion, but their order differs from the previous example.
- Review the replacement ordering and availability assumptions in the exact plan.
address=example.service
actions=["create","delete"]
identity and traffic=not reviewed
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Review the replacement ordering and availability assumptions in the exact plan.
Why this result follows: Both action sequence and resource behavior matter to transition risk.
14. Unknown nested value
Problem: Can this planned endpoint be reported as a final string?
- The update is proposed while the endpoint remains undetermined.
- Keep the endpoint unknown and verify it after an authorized operation.
after.endpoint=unknown
actions=["update"]
apply=not run
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Keep the endpoint unknown and verify it after an authorized operation.
Why this result follows: An unknown field is not a concrete value merely because another action is known.
15. Sensitive marker
Problem: Does a sensitive marker make the raw file safe for a public ticket?
- The raw structured artifact still requires restricted handling.
- Use controlled storage and a sanitized summary rather than posting the file.
plan sensitivity=marked
raw JSON=contains sensitive context
ticket=public
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Use controlled storage and a sanitized summary rather than posting the file.
Why this result follows: A marker is not an access-control or retention policy.
16. Changed variables
Problem: Does the old plan cover a new variable value?
- The effective input changed after review.
- Produce and review a current proposal for the intended input.
reviewed replicas=2
intended replicas=4
updated plan=not reviewed
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Produce and review a current proposal for the intended input.
Why this result follows: Changed variables can alter actions and impact.
17. Different provider
Problem: Does this artifact establish the current provider selection?
- The recorded provider version differs from the current selection.
- Review the effective dependency and an updated plan.
plan provider version=3.7.2
current lock selection=3.8.0
new plan=not reviewed
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Review the effective dependency and an updated plan.
Why this result follows: Provider selection is part of the plan context.
18. Unmanaged resource
Problem: Does this no-change result cover a resource outside its scope?
- The plan record concerns A and does not manage B.
- Review B independently before claiming its state or policy is correct.
managed address=example.A
actions=["no-op"]
resource-B=outside configuration
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Review B independently before claiming its state or policy is correct.
Why this result follows: A plan cannot establish an unmanaged resource’s configuration.
19. Parser version
Problem: Can a parser assume every future JSON version has identical fields?
- The artifact’s format version and parser compatibility are not established.
- Check the documented format and parser handling before trusting its summary.
parser expected format version=1
artifact format version=unreviewed
parse result=not observed
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Check the documented format and parser handling before trusting its summary.
Why this result follows: A parser’s assumptions need to match the artifact format.
20. Remote validation
Problem: Does parsing an update prove the application works after it?
- The parser classified a proposal, but no apply or user test is recorded.
- Keep application behavior unverified and plan independent validation.
actions=["update"]
parser=success on fixture
application test=not run
This fixture runs no Terraform and contains no real plan artifact.
Expected result: Keep application behavior unverified and plan independent validation.
Why this result follows: Structured parsing is not execution or user-path evidence.
Common errors and fixes
A proposed update is reported as applied
- Why it happens
- Plan and apply are separate stages.
- How to fix it
- Report the proposal and verify any later authorized apply independently.
- Prevent it next time
- Label evidence with its stage and target.
Sensitive JSON is placed in a public log
- Why it happens
- Redaction in human output was assumed to apply everywhere.
- How to fix it
- Use the incident process and restrict affected artifacts.
- Prevent it next time
- Protect plans and avoid printing their contents.
An unknown value is interpreted as empty
- Why it happens
- The final value has not yet been established.
- How to fix it
- Treat it as unknown and inspect the relevant plan representation.
- Prevent it next time
- Test policies against both known and unknown examples.
20 practice exercises
1. A plan shows an update with an unknown output. What is known?
Show hint
Separate the action from the unresolved output and later execution.
Show worked solution
The update is proposed and the output is not yet determined. Neither a successful apply nor a final output is established.
The record proposes an update while the output remains unknown. It does not establish a successful apply or the final output value. Preserve the unknown explicitly and verify the actual result through an authorized process after it becomes available.
Check your solution
- Identify the update as proposed.
- Keep the output and apply outcome unverified.
2. A reviewer can read a JSON plan containing sensitive fields. What should the team check?
Show hint
Treat the entire structured artifact as potentially sensitive.
Show worked solution
Confirm the reviewer is authorized, restrict storage and logs, and apply the approved retention process. Do not paste the artifact into a ticket.
Confirm that the reviewer is authorized, restrict artifact storage and logs, and apply the approved retention policy. Share a sanitized action summary rather than pasting the raw JSON into a ticket. A sensitivity marker is not a substitute for controlling the file and its copies.
Check your solution
- Verify reviewer authorization.
- Protect storage, logs and retention independently.
3. A structured plan shows actions ["update"] and an endpoint marked unknown. What is established?
Show hint
Separate the proposal from its unresolved value.
Show worked solution
The update is proposed and the endpoint is not yet determined. No successful apply or final endpoint is established; record the exact address and context and verify the value later through an authorized process.
Check your solution
- Identify the proposed update.
- Keep the endpoint unknown.
4. A record lists ["delete","create"] for a data-bearing resource. Is it simply an in-place update?
Show hint
Read the action sequence.
Show worked solution
No. Treat the sequence as a replacement proposal and review identity, data, retention, dependencies and availability before any authorized implementation. The illustrative record does not establish that either action occurred.
Check your solution
- Identify deletion plus creation.
- Require data and availability review.
5. A JSON plan contains sensitive fields, and a reviewer can read it. What should the team check?
Show hint
Access to a file is not necessarily approved retention or sharing.
Show worked solution
Confirm the reviewer’s authorization, restrict storage and logs, and apply the approved retention process. Share a sanitized action summary rather than pasting the raw artifact into a ticket or public channel.
Check your solution
- Verify reviewer authorization.
- Protect storage, logs and retention.
6. A plan was generated in dev, but the intended change is in prod. Does the dev artifact authorize production?
Show hint
A plan has a specific state and input context.
Show worked solution
No. Review the production backend, workspace, provider target, inputs and exact plan under the approved process. A dev approval does not establish the proposed production actions or their authorization.
Check your solution
- Identify dev versus prod.
- Require a production-specific artifact.
7. A planned endpoint is unknown. Can the reviewer record it as null?
Show hint
Unknown and null have different meanings.
Show worked solution
No. Record that the value is not yet determined and verify it after the appropriate authorized operation. Null is a specific value or absence marker, not a synonym for every unknown planned field.
Check your solution
- Identify the unknown endpoint.
- Do not substitute null without evidence.
8. A plan is approved but apply was not run. Can the team report the resource changed?
Show hint
Approval is not execution.
Show worked solution
No. Keep the change unverified until an authorized apply and relevant state or remote observations establish what occurred. Preserve the reviewed proposal separately from later execution evidence.
Check your solution
- Identify apply as not run.
- Do not report an observed change.
9. An apply fails after resource A changes and resource B is unknown. Does the error prove no effects?
Show hint
A multi-step operation can stop partway.
Show worked solution
No. Inspect the actual state and remote objects, preserve the error and reconcile with the approved recovery plan before retrying. The record already shows a partial effect on A.
Check your solution
- Identify A changed and B unknown.
- Require inspection before retry.
10. A local parser classifies a synthetic record as an update, but no provider plan ran. Is provider behavior verified?
Show hint
Parsing and provider execution are separate.
Show worked solution
No. The parser result concerns the supplied fixture only. Review an authorized actual plan and test the relevant application behavior separately; do not infer remote changes from the local classification.
Check your solution
- Identify the synthetic parser result.
- Keep provider behavior unverified.
11. A plan lists ["create"] for a bucket, but apply is not observed. Does the bucket exist?
Show hint
A proposed create is not a remote observation.
Show worked solution
Not established. Verify the actual target and object through an authorized process before reporting existence. The structured plan describes a proposed action, not a completed resource creation.
Check your solution
- Identify the proposed create.
- Keep remote existence unverified.
12. A plan proposes ["delete"] for records, while retention and backup testing are unknown. What review is needed?
Show hint
A data-bearing deletion has operational consequences.
Show worked solution
Hold implementation while the data owner, retention constraints, dependencies and tested recovery procedure are established. A machine-readable action alone does not show that the records are disposable.
Check your solution
- Identify the proposed deletion.
- Require retention and recovery review.
13. A plan sequence is ["create","delete"] rather than ["delete","create"]. What should a reviewer examine?
Show hint
Action order can affect a transition.
Show worked solution
Review the exact replacement ordering, provider behavior, naming, quota, data handoff and traffic assumptions. Both records include creation and deletion, but the sequence can change operational risks and does not itself prove readiness.
Check your solution
- Identify the create-then-delete sequence.
- Review availability and data handoff.
14. An update is proposed while after.endpoint is unknown. Can a final endpoint be reported?
Show hint
Known action and unknown field are separate.
Show worked solution
No. Record the endpoint as unknown and the update as proposed. Verify the actual value only after an appropriate authorized operation and observation; do not infer it from the action type.
Check your solution
- Identify the unknown endpoint.
- Keep apply and final value unverified.
15. A raw JSON plan is marked sensitive but proposed for a public ticket. Is the marker sufficient protection?
Show hint
A marker is not an access policy.
Show worked solution
No. Confirm authorized reviewers and use controlled storage, logging and retention, with a sanitized summary for wider discussion. Raw structured output can still contain sensitive values and infrastructure details.
Check your solution
- Identify the public disclosure risk.
- Protect the complete artifact.
16. A reviewed plan used replicas=2, but the intended input is now four. Can the old artifact be assumed current?
Show hint
Effective input changes can alter proposed actions.
Show worked solution
No. Generate and review an updated proposal for the actual input and target under the documented workflow. Preserve the old artifact as evidence of the earlier decision, not approval of the new one.
Check your solution
- Identify two versus four.
- Require review of the updated plan.
17. A plan records provider 3.7.2, while the current lock selects 3.8.0. Does it represent the current dependency context?
Show hint
Provider selection is part of the plan context.
Show worked solution
Not established. Review the effective provider selection and produce or inspect a current plan for the intended workflow. A changed provider can affect schema interpretation or actions even if configuration text is unchanged.
Check your solution
- Identify the version difference.
- Review a current dependency context.
18. A no-op record covers resource A, while resource B is outside the configuration. Does it verify B?
Show hint
A plan covers its managed scope.
Show worked solution
No. Review B and its requirements independently. A no-op for A does not establish B’s existence, policy or configuration and should not be summarized as complete infrastructure verification.
Check your solution
- Identify B outside scope.
- Keep B unverified.
19. A parser expects one JSON format version, but the artifact version is unreviewed. Can its summary be trusted automatically?
Show hint
The parser’s assumptions must match the artifact.
Show worked solution
Not without checking. Inspect the documented format version and parser handling, including unknown fields and sensitive data, before relying on its output. Preserve the original artifact in controlled storage.
Check your solution
- Identify the unreviewed format version.
- Review parser compatibility.
20. A parser succeeds on an update fixture, but no apply or user test ran. Is the application ready?
Show hint
Parsing, execution and user behavior differ.
Show worked solution
No. The parser classified supplied text only. Review the actual authorized plan and execution, then test the representative user operation and dependencies independently.
Check your solution
- Identify the synthetic parser scope.
- Keep application readiness unverified.
Key takeaways
- A plan is context-bound proposed change.
- Unknown is not an empty value.
- JSON plans and state require sensitive handling.
- A JSON plan is a proposal, not an apply result.
- Unknown and null are not interchangeable.
- Raw structured plans can expose sensitive information.