Skip to content

Authoring skill

Load this before you write or change a .tf or *.turf.hcl file: a configuration from a request in plain language (“create an S3 bucket”, “use the Azure AVM disk module”), an edit the user asked for, or an overlay that adds an interaction point. skill_deployment comes first in any session: it runs what you write — the convergence, approval, turf actions, recovery. Setting variable values (var, var_file, a .tfvars line) is deployment, not authoring.

Turf has no authoring tools. The configuration directory is the desired state, and every plan is a projection of whatever its files say, so the files you write are the declaration: the user can read them, check them into git, run them anywhere Terraform runs, and reopen them next session. You already know HCL; this skill covers the loop around it and where Turf differs.

No file tool? Say so plainly: Turf can still run an existing configuration — plan, apply, destroy, import, refresh, run actions — but writing one needs a file tool.

init({ path: "/path/to/app" }) # register the directory; an absent one is created (with a .gitignore)
…write versions.tf, main.tf… # your file tools
init({ path: "/path/to/app" }) # again once providers and modules are written: installs them
open({}) # the backend comes from the files
up({ var: { … } }) # the plan of the whole directory, paused at its approval point
…edit → up again # each up supersedes the paused convergence
apply({ convergence_id: "…", plan_digest: "…" }) # after review and approval, as skill_deployment says
  • Every plan is the whole directory. To change a plan, edit the files and up again. There is no per-resource planning call.
  • Never edit between up and apply. The engine checks the files again before applying; a plan whose files changed is never applied (it ends stale). Edit, up, then approve the new plan.
  • Re-run init after adding a module block or a provider (one an overlay’s action needs included): it installs them and updates the lock file.
  • Errors name a file and line. Fix the file and up again; read each round’s diagnostics too.
  • Don’t rewrite the configuration to force convergence. A deferral resolves by applying and planning the next round, which apply does by itself — not by hard-coding a value or splitting the work.
  • provider_search to find a provider; provider_describe for the exact schema of a resource_type, datasource_type or action_type — required arguments, nested blocks, which attributes are write_only, and the identity_schema an import can use — or of one provider-defined function, called as provider::<local name>::<function>(…) from a module whose required_providers declares the provider (each module declares its own; the built-in one as terraform = { source = "terraform.io/builtin/terraform" }, whose encode_tfvars, decode_tfvars and encode_expr are in the Terraform documentation, not provider_describe). Write from the schema, not from memory: provider schemas drift between versions. Pin the version in versions.tf and run init first, then describe the version init resolved (providers[]), so the schema is the one that will run.
  • A module’s interface is in its files. Write the module block with just source (and version for a registry source), run init, and read the installed module: modules/modules.json under the data_dir init reports (.terraform, unless TF_DATA_DIR moves it) maps each call to its directory (a local source is read in place). Its variable blocks are the inputs (no default = required), its output blocks what it exposes, its required_providers what it needs — configuration_aliases there means the call passes those slots in providers = { … }.
  • To look something up, declare a data block and read the value from the plan document (references/data-sources.md).

A conventional layout, which Turf does not require but users expect:

File Holds
versions.tf terraform { required_providers { … } backend "…" { … } } — pin each provider (~> MAJOR.MINOR)
providers.tf provider {} blocks — one per aliased instance
variables.tf variable {} blocks
main.tf (or one file per concern) resources, data sources, modules, locals
outputs.tf output {} blocks
*.turf.hcl Turf overlays: action and top-level action_trigger blocks, which tofu and terraform ignore
  • Record the why as a comment above the block it explains — the request, constraint or policy behind it. Nothing else carries it across sessions.
  • Reference, don’t copy. Wire values with expressions (aws_vpc.main.id, module.net.subnet_ids): a computed value is unknown until applied, and a pasted literal goes stale.
  • A provider with no settings needs no block; every aliased instance needs its own. Provider blocks belong in the root module only (references/providers.md).
  • Keep the backend’s non-secret settings in the file, so a reopen needs nothing but credentials.
  • Root outputs persist; module outputs do not. To keep a value — an endpoint, a generated name — make it a root output; output reads it any time.
  • Provider credentials → the environment providers run with (skill_deployment → references/credentials.md), or a variable (sensitive = true, plus ephemeral = true when it only feeds provider blocks and write-only arguments) passed as var on each plan command.
  • Backend credentials → out of the backend block, into open’s backend_config.
  • A secret a resource needs → only a write-only argument (write_only in provider_describe), fed by an ephemeral variable or an ephemeral resource. Anything else keeps the secret in state forever; if there is no write-only argument, say so.

Precedence, validation and module inputs: references/variables.md.

Form Resolved
var.region at plan
aws_vpc.main.id at plan where known; otherwise unknown until applied, and what needs it at plan defers a round
data.aws_ami.latest.id when the plan reads the data source (every plan reads every declared one)
ephemeral.vault_kv_secret_v2.db.data.password when the plan opens it; never stored — only a write-only argument or a provider block may take it
module.net.subnet_ids as the module’s output resolves

Unknowns print as __cty_unknown__, and sensitive values as __cty_sensitive__. A reference to something the configuration does not declare fails the plan, naming it; an output a module does not declare fails once the call is planned (“Unsupported attribute”), and reads unknown while the call is deferred.

Terraform semantics: resources, data sources, ephemeral resources, locals, variables with validation {}, outputs (a child module’s may be ephemeral = true; a root output may not), count/for_each, dynamic blocks, registry/git/local modules, depends_on, lifecycle (create_before_destroy, ignore_changes, replace_triggered_by, prevent_destroy, and precondition/postcondition on resources and data sources), moved, removed, import, and action blocks with their triggers.

  • depends_on on a data source: use it when the query’s values are already known but the object they name does not exist yet. Turf does not infer that ordering, any more than Terraform does.
  • replace_triggered_by says that replacing a host takes its contents with it (references/lifecycle.md). Nothing can infer that.
  • A local module source may climb out of the directory (source = "../modules/x"), as in Terraform: sibling configurations can share a modules/ beside them. It is read in place, from the directory the configuration’s symlinks lead to, so it has to be wherever the engine reads the configuration too.
  • Refused constructs — check blocks, conditions on ephemeral resources and output preconditions, provisioners, module enabled, provider blocks in child modules and more — fail the plan by name. Don’t write them; if the user needs one, tell them. The list, each with its remedy: skill_deployment → references/divergences.md.
The user wants Edit
Change a resource edit its block → up
Remove it (and destroy it) delete the block → up plans the delete
Stop managing it, leave it running delete the block; add removed { from = … lifecycle { destroy = false } }
Rename or move it change the address; add moved { from = … to = … } — a no-op, not destroy + create
Adopt something that exists an import { to = … id = … } block (reviewable in the plan), or the import tool
Replace it though nothing changed plan({ replace: ["<address>"] }) on the round at its gate — no edit
Tear everything down but keep the files destroy — deployment; no edit

“Remove” and “destroy” are different requests: ask which one the user means. A delete of anything that holds data — a database, a bucket, a volume — is the user’s call before it is planned: offer a backup, or the removed block. Details: references/lifecycle.md; adopting: skill_deployment → references/imports.md.

  • A checkpoint or an agent step in a rollout — “ask me before the database is replaced”, “verify the bucket is private after it is created”, “tell the team when it is live” — is a turf_action bound by a top-level action_trigger in a *.turf.hcl overlay in the configuration directory. Its target reaches a module’s resource by path (module.db.aws_db_instance.main). Tell the user which file you wrote: it is theirs.
  • For one rollout only, pass the overlay in memory as overlays on the plan command instead of writing it.
  • An operation right now — restart a service, run a smoke test — is invoke: no file at all.

Schema, events, on_failure, condition, keyed entries and the bare-token gotcha: references/actions.md.

When the user asks you to change a configuration they wrote: read the files first, make the smallest edit that does the job, keep their layout, naming and comments, and tell them exactly what you changed — add, change or remove, in which files. Prefer a new file for a new concern over restructuring theirs.

  • Durability. Pass a real path to init and the work outlives the session. Omit path only for throwaway work: Turf allocates a scratch directory.
  • Reopen. init on the same path rediscovers the backend, providers, variables and outputs; open binds the workspace and reports a convergence still holding it; up plans whatever no longer matches the state.
  • Not applying keeps file edits. Declining a plan never reverts the files; use git when the user wants the edits gone too.
  • Agent memory holds pointers — the directory’s path, the backend and workspace, the user’s intent, the names of the credentials — never the configuration, secrets, computed values or plan digests: references/memory-conventions.md.

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