Skip to content

Turf Actions Reference — Answering

Experimental. A turf_action is an action no plugin performs, because you do. This file is about answering one when the apply stops for it. Declaring one — the action block, triggers, overlays, on_failure — is authoring: skill_authoring → references/actions.md.

A turf action is an apply-time step that may or may not succeed: a check, a notification, a tool call, a conversation with the user. It is not an approval — by the time it runs, the plan is approved. It reports exactly as a provider action does: progress as it goes, then diagnostics, an error among them when it failed. On a failure, the trigger’s on_failure decides what happens to the operation it is bound to, and each request says so in words (if_failed).

Its provider is the engine’s built-in terraform.io/builtin/turf, implied by the turf_ prefix: nothing to declare or install. provider_describe({ action_type: "turf_action" }) returns its schema without a version.

apply({ convergence_id: "…", plan_digest: "…" })
→ { outcome: "awaiting_actions", round: 1,
action_requests: [{
key: "action/1/action.turf_action.verify_web@after_create@docker_container.web",
action: "action.turf_action.verify_web",
invocation: "action.turf_action.verify_web@after_create@docker_container.web",
caller: "docker_container.web",
event: "after_create",
on_failure: "taint",
if_failed: "A failure taints docker_container.web, so the next plan replaces it, and halts what waits on it.",
prompt: "Verify the web container serves: …",
inputs: { container_id: "3f2a…", url: "http://localhost:8080/" },
asked_at: "2026-10-10T14:02:11Z" }],
rounds, next }
  • prompt says what to do and what counts as failure; inputs are the values to work with — IDs, endpoints, names.
  • caller is the resource the action is bound to, and event the lifecycle edge: a before_* step gates the change, an after_* step follows it.
  • What comes back together: every request open at that moment. One that opens later, behind work still running, makes another pause. plan.invocations listed every action the round runs, per caller in run order — a caller’s before_* steps one after another before its change, its after_* steps after it — so each further turf action on a caller you answered for comes as its own pause. Only the first pause gives the guidance (note) in full; later ones remind.
  • apply({ convergence_id: "…" }) with nothing else lists what is waiting again.

Answer every open request in one call:

apply({ convergence_id: "…", action_results: {
"action/1/action.turf_action.verify_web@after_create@docker_container.web": {
succeeded: true,
progress: ["GET http://localhost:8080/ → 200 in 4 ms; the body has \"Welcome to nginx\"",
"docker inspect 3f2a…: State.Running=true, RestartCount=0"],
diagnostics: [{ severity: "warning", summary: "The image is not pinned by digest",
detail: "nginx:1.27-alpine resolves by tag" }] } } })
Field Meaning
succeeded Required. false fails the action, and on_failure decides what that does.
progress What you did, a line each, in order — the commands, what each showed, the user’s own words.
diagnostics {severity, summary, detail}. An error for each reason it failed — required when succeeded is false, refused when it is true. A warning for anything worth knowing that did not fail the step: recorded on the action and listed in the round’s warnings.

The call goes on following the apply: to the next turf actions, the next approval point, or the end.

Refused results. A result the engine cannot take — a failure with no error, a success with one, a severity other than error/warning — is named under refused with the reason, and its request stays open. The others were taken. Fix the refused one and send it alone.

  • Report honestly. A step you could not perform — no tool reaches the system, the user did not answer — failed: say why in an error. Nothing is retried: a failure settles, and to try again, fix the cause and run up.
  • A decision is the user’s. When a prompt asks for the user’s decision, put it to them — every such question at once, one answer per item — quote their words in progress, and report a “no” as a failure whose error gives their reason. Never answer one for them, and never weaken or remove a trigger to get past it.
  • In a destroy, every failure is only a warning and the teardown goes on, as a failed provider action is in the Terraform destroy walk. A before_destroy gate cannot stop a destroy, so get the user’s explicit words before applying a destroy plan. On a delete that up plans (an orphan, a replace), a failing gate does what its if_failed says.
  • A step that fails before you are asked — its configuration cannot be resolved, holds a sensitive value, or its inputs pass 64 KiB — fails the action without a request, and on_failure applies as for any failure.

Examples.

  • Verify after a create (after_create, on_failure = taint): run the check the prompt names against inputs.url. It answers 200: succeeded: true with what each check showed. It answers 502: succeeded: false with {severity: "error", summary: "GET http://localhost:8080/ returned 502"} — the container is tainted, and the next up replaces it.
  • A notification (on_failure = continue): post the line with your messaging tool. With no such tool, fail and say so: the apply goes on, and the round warns.
  • A conversation (before_update, on_failure = halt): show the user what changes, ask, and quote them. “Go ahead” succeeds and the update lands; “no” fails, and the update and what depends on it never run.

rounds[].invoked counts every action that ran. rounds[].actions lists only those that did not simply succeed, turf and provider actions alike — failed, skipped (its trigger’s condition was false at apply), tainting its caller (caller_tainted), or carrying warnings — with invocation, action, type, caller, event, on_failure, status, succeeded, detail (the error) and warnings. A failure on_failure = continue let pass is listed there and warned about. What a halt left unstarted is counted in rounds[].skipped.

terraform apply -invoke=ADDR: name an action the configuration declares, or lay an ad-hoc one over it in memory for this convergence alone (the directory is untouched):

invoke({ action_addr: "action.turf_action.verify_web" })
invoke({ action: { type: "turf_action", name: "check",
config: { prompt: "Check the bucket is private; fail if not.", inputs: { bucket: "prod-logs" } } } })

It stops at its approval point like every plan command (plan.invocations names the invocation); apply runs it and returns awaiting_actions for you to answer. An ad-hoc action’s config is literal values: a ${ in it is text, not an expression. caller does not exist in a direct invoke, as in tofu apply -invoke. Provider actions run the same way: provider_describe({ action_type: "…" }) describes one.

No client capability is needed: nothing is asked by elicitation or sampling. The apply call returns, and your next apply answers.

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