Skip to content

Invoke an action

invoke runs one action now, as terraform apply -invoke does: an action the configuration declares, or an ad-hoc one laid over the configuration in memory for this run alone. Turf™ plans it in one round and stops at the approval point. What the action’s configuration reads is refreshed; nothing else changes.

✦Your agentin Claude Code
You
Run a one-off check on kind-crd: is the custom resource being served?
Agent
  • invoke→awaiting_plan
  • plan→awaiting_approval

This runs one ad-hoc turf action, action.turf_action.check, laid over the configuration in memory. Nothing else is planned, and your files are untouched. The apply will stop for me to do the check. Ready to run it?

You
Go ahead.
Agent
  • apply→awaiting_actions
  • apply→converged

I ran kubectl --context kind-turf-crd-demo-1 get turf example-turf: it is served, with spec.message “Hello from Turf”. I reported the step as succeeded, with that command and its result as progress.

TOOL RESULTapply→awaiting_actions
round: 1
action_requests: [ {
key: "…",
action: "action.turf_action.check",
prompt: "Check that the custom resource example-turf is served; fail if not.",
inputs: { context: "kind-turf-crd-demo-1", name: "example-turf" } } ]
next: { tool: "apply", args: { convergence_id: "…" } }

illustrative · the shape of a session, not a transcript

Name the action, or describe the step: “invoke action.aws_lambda_invoke.warm”, or “run a check that the bucket is private”. The agent calls invoke, then plan; plan.invocations names the invocation. An invoke needs your yes: the agent presents it and asks before applying. A turf action then stops the apply for the agent to carry out, as on Answering a turf action.

A declared action is named by its address, module-qualified where a module declares it, in a .tf file or a *.turf.hcl overlay:

invoke({ action_addr: "action.aws_lambda_invoke.warm" })
invoke({ action_addr: "module.app.action.turf_action.check" })

An ad-hoc action is laid over the configuration as an in-memory overlay for this run only; the directory is untouched:

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

Its config is literal values: a ${ in it is text, not an expression. An action whose config needs nested blocks is declared in a *.turf.hcl file instead. provider names the provider instance to run it on (aws.west); omit it for the default.

One round. invoke stops at its plan gate like every start verb; plan plans the invocation and stops at its approval point; apply with the digest runs it. A turf action returns awaiting_actions for the agent to answer. caller does not exist in a direct invoke, as in tofu apply -invoke, so an action whose config reads caller cannot run this way.

Provider actions run the same way. provider_describe with action_type describes one (and turf_action, Turf’s own, with no version). Declaring an action, a Terraform® action or a turf action, is authoring: see Terraform actions and overlays.

Argument Meaning
action_addr An action the configuration declares, by address (action.aws_lambda_invoke.warm, module.app.action.turf_action.check). Set this or action.
action An action to run without declaring it: type (aws_lambda_invoke, turf_action), name (default invoke), config (its attributes) and provider (the instance, such as aws.west). Set this or action_addr.
workspace_alias, var, var_file, overlays, plan_only As for every start verb: see Deploy or update with up.

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