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.
The loop
Section titled “The loop”init({ path: "/path/to/app" }) # register the directory; an absent one is created (with a .gitignore) …write versions.tf, main.tf… # your file toolsinit({ path: "/path/to/app" }) # again once providers and modules are written: installs themopen({}) # the backend comes from the filesup({ var: { … } }) # the plan of the whole directory, paused at its approval point …edit → up again # each up supersedes the paused convergenceapply({ 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
upagain. There is no per-resource planning call. - Never edit between
upandapply. The engine checks the files again before applying; a plan whose files changed is never applied (it endsstale). Edit,up, then approve the new plan. - Re-run
initafter adding amoduleblock 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
upagain; read each round’sdiagnosticstoo. - Don’t rewrite the configuration to force convergence. A deferral resolves by applying and planning the next round, which
applydoes by itself — not by hard-coding a value or splitting the work.
Before writing: discover
Section titled “Before writing: discover”provider_searchto find a provider;provider_describefor the exact schema of aresource_type,datasource_typeoraction_type— required arguments, nested blocks, which attributes arewrite_only, and theidentity_schemaan import can use — or of one provider-definedfunction, called asprovider::<local name>::<function>(…)from a module whoserequired_providersdeclares the provider (each module declares its own; the built-in one asterraform = { source = "terraform.io/builtin/terraform" }, whoseencode_tfvars,decode_tfvarsandencode_exprare in the Terraform documentation, notprovider_describe). Write from the schema, not from memory: provider schemas drift between versions. Pin the version inversions.tfand runinitfirst, then describe the versioninitresolved (providers[]), so the schema is the one that will run.- A module’s interface is in its files. Write the
moduleblock with justsource(andversionfor a registry source), runinit, and read the installed module:modules/modules.jsonunder thedata_dirinitreports (.terraform, unlessTF_DATA_DIRmoves it) maps each call to its directory (a local source is read in place). Itsvariableblocks are the inputs (nodefault= required), itsoutputblocks what it exposes, itsrequired_providerswhat it needs —configuration_aliasesthere means the call passes those slots inproviders = { … }. - To look something up, declare a
datablock and read the value from the plan document (references/data-sources.md).
Writing the files
Section titled “Writing the files”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;outputreads it any time.
Secrets never go in a file
Section titled “Secrets never go in a file”- Provider credentials → the environment providers run with (
skill_deployment → references/credentials.md), or avariable(sensitive = true, plusephemeral = truewhen it only feeds provider blocks and write-only arguments) passed asvaron each plan command. - Backend credentials → out of the
backendblock, intoopen’sbackend_config. - A secret a resource needs → only a write-only argument (
write_onlyinprovider_describe), fed by an ephemeral variable or anephemeralresource. 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.
Expression syntax
Section titled “Expression syntax”| 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.
What Turf honours
Section titled “What Turf honours”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_onon 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_bysays 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 amodules/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 —
checkblocks, conditions on ephemeral resources and output preconditions, provisioners, moduleenabled, 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.
Changing what exists
Section titled “Changing what exists”| 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.
Actions and interaction points
Section titled “Actions and interaction points”- 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_actionbound by a top-levelaction_triggerin a*.turf.hcloverlay in the configuration directory. Itstargetreaches 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
overlayson 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.
Editing files you did not write
Section titled “Editing files you did not write”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.
The directory is the desired-state store
Section titled “The directory is the desired-state store”- Durability. Pass a real
pathtoinitand the work outlives the session. Omitpathonly for throwaway work: Turf allocates a scratch directory. - Reopen.
initon the same path rediscovers the backend, providers, variables and outputs;openbinds the workspace and reports a convergence still holding it;upplans 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.
Reference files
Section titled “Reference files”references/providers.md— requiring, installing and pinning providers; blocks, aliases, sources, the lock file.references/variables.md— precedence, validation, ephemeral variables, write-only arguments, module inputs.references/data-sources.md—datablocks, when they are read, deferred reads.references/lifecycle.md—create_before_destroy,ignore_changes,replace_triggered_byand host replacement,moved,removed.references/actions.md— declaring actions and triggers; overlays;on_failure.references/memory-conventions.md— what agent memory holds, and what it never does.
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