Refresh state
refresh reads every object the workspace manages and writes what it found into state. It changes
nothing in the world. Like every Turf™ run, it plans first and stops at an approval point, so you see
what state will record before it does.
Example configuration: turf-examples/terraform/kubernetes/kind-crd
refresh→awaiting_planplan→awaiting_approval
The refresh found one object that changed outside Turf:
~ kubernetes_manifest.instance manifest.spec.message: "Hello from Turf" → "edited by hand"Applying this writes the new value into state. Nothing in the cluster changes. Ready to apply these changes?
apply→converged
State now records the message as it is in the cluster. Your files still say “Hello from Turf”, so the
next up will plan setting it back, unless you change the files to match.
illustrative · the shape of a session, not a transcript
Ask in words: “refresh the state of kind-crd”. The agent calls refresh, then plan, presents what
the refresh found, and applies on your yes.
To see drift without writing anything, ask for a plan instead: “plan kind-crd and tell me what drifted”. A plan on an applied configuration reads every object first, so the plan is the drift report.
To hear about drift between plans, without asking, see Watching for drift.
The CLI has no refresh command. Ask its agent in the configuration directory:
cd path/to/config && turf chatThen type “refresh the state”. For a one-shot request, turf exec "refresh the state" runs it without
the TUI; without --yes a plan that needs your yes is left waiting at its approval point.
How it works
Section titled “How it works”What it runs. refresh is tofu apply -refresh-only: one round, the same plan gate and approval
point as up. plan reads every managed object and plans writing what it found into state; apply
with the plan’s digest writes it. A refresh always reads every object. To read fewer, scope an up’s
plan: a scoped refresh.
Where drift shows. plan.drift counts the objects the refresh found changed outside Turf,
and the plan document lists them under resource_drift. After the apply, rounds[].drift records how
many the round wrote into state.
The count can be lower than the list. The count is the engine’s. A row whose read differs from
its record only in a null collection against an empty one is still listed in resource_drift, as
OpenTofu® lists it, and is not counted: a plan of the two plans nothing. The result’s note says so
when the count and the list differ. The count is never higher than the list.
refresh: false is something else. It is an option of a round’s plan
(tofu plan -refresh=false): plan against the state as recorded, without reading the objects. It
holds for that round only.
What a plan on an applied configuration tells you
Section titled “What a plan on an applied configuration tells you”With refresh on (the default), every up plan reads every object first. What the plan shows is the
drift report:
| Plan | Meaning | What the agent does |
|---|---|---|
converged at once, nothing applied |
State matches the files | Tells you “no drift”. |
update or replace |
Reality diverged from the files | Presents the diff and asks whether to bring reality back to the files (apply) or the files to reality (edit them, then up). |
orphan delete |
In state, no longer in the files | Asks: restore the block, forget it with a removed block, or let the delete proceed. |
create |
In the files, not in state | Deleted out of band, or never applied: the apply creates it again. |
A scoped refresh
Section titled “A scoped refresh”An up’s plan can read fewer objects than all of them. Two arguments of plan say what the round
reads:
refresh_addresses: the managed resource instances you list.refresh_drift: true: what the workspace’s open drift notices name. The server fills the list in as the round plans. With both arguments, the round reads both sets.
plan({ convergence_id, refresh_drift: true })→ outcome: awaiting_approval, refresh_scope: { addresses: ["kubernetes_deployment_v1.web"], count: 1, from_drift: 1, skipped: 41 }Any up takes this plan at its plan gate. When drift notices are open, the note at round 1’s plan
gate names it. The default has not changed: next is plan without either argument, which reads
everything.
The plan is still a plan of the whole configuration. What changes is what it reads first:
- A row in the scope is read before it is planned, as every row is by default.
- A row inside a module is matched as a root row is, by its full instance address.
- A row outside it is planned from its record. If that plan is a change, the row is read and planned again, so nothing is applied over a record nobody checked. A deferral is not a change.
- Data sources are read at every plan, scoped or not.
- An object no longer in the files is read only when the scope names it.
- A moved resource answers to its new address or the one it moved from.
What skipped means. refresh_scope.skipped counts the managed rows the round planned from their
records without reading them, and rounds[].refresh_skipped records the same count. For those rows
the plan did not look for drift. An object that changed outside Turf, is not in the scope and plans no
change of its own stays as it is, unnoticed by this plan. So a scoped plan answers a notice quickly;
it is not a drift report. plan with neither argument reads everything.
refresh_scope |
Meaning |
|---|---|
addresses |
The addresses the round was told to read, up to 20. omitted counts the rest. |
count |
How many addresses the scope holds. |
from_drift |
How many of them came from the open notices. |
skipped |
Rows planned from their records, unread. |
whole |
true when the round read every object instead: refresh_drift found nothing open, or the notices could not give a complete scope. |
A scope belongs to an up’s plan and to that round alone: a later round reads everything unless its
own plan says otherwise. It is refused with refresh: false, and in a destroy, refresh,
import or invoke plan. A refused call sends nothing, and the round still waits at its plan gate.
Arguments
Section titled “Arguments”refresh takes the arguments every start verb takes: workspace_alias, var, var_file,
overlays and plan_only (see Deploy or update with up). Its plan
takes refresh; replace, refresh_addresses and refresh_drift are refused.
Related
Section titled “Related”- Watching for drift: drift between plans, and the plan that answers it.
- Reading state and outputs
- Deploy or update with up
- Plan and apply by hand
Turf™ is a trademark of Turf LLC. Terraform® is a trademark of HashiCorp. Ansible® is a trademark of Red Hat, LLC, registered in the United States and other countries. Helm®, Kubernetes®, Prometheus® and OpenTelemetry® are registered trademarks, and Jaeger™ is a trademark, of the Linux Foundation. OpenTofu® and Model Context Protocol® are registered trademarks of LF Projects, LLC. All other trademarks are the property of their respective owners. Turf is not affiliated with, endorsed by, or sponsored by HashiCorp, IBM, Red Hat, the Linux Foundation, LF Projects or the OpenTofu project.
© 2026 Turf LLC. Free for individuals, education and small businesses within the Community limits, under the Turf Community Edition License 1.0. Government and larger organizations need a commerciallicense.turf.build · Discord ·GitHub