hashicorp/terraform
Systems
Terraform Core is organized as a stack of cooperating subsystems. This index gives the one-line elevator pitch for each, in the order you'd encounter them following the path of a terraform plan invocation.
Entry and dispatch
- CLI dispatch —
main.go,commands.go, thecli.CLIrunner, the-chdiroption,TF_CLI_ARGShandling, autocomplete. - Command package — the per-subcommand handlers in
internal/command/, the sharedcommand.Meta, flag parsing, and the views that render output.
Configuration and language
- Configuration loading —
internal/configs/. HCL parsing, schema, modules, providers, test files. - Language evaluation —
internal/lang/. Expression evaluation, references, the function library, marks (sensitive, ephemeral). - Addresses —
internal/addrs/. Typed addresses for resources, modules, providers, references.
The graph engine
- Terraform Core engine —
internal/terraform/.terraform.Context, graph builders, transforms,EvalContext, vertex evaluation. - DAG primitive —
internal/dag/. The directed-acyclic-graph type and walk algorithm shared by every engine subsystem.
State and plans
- State —
internal/states/,statefile,statemgr. The in-memory state, its JSON serialization, and the synchronizer. - Plans —
internal/plans/,planfile. Proposed and applied changes, the plan file format, deferred actions.
Backends and HCP Terraform
- Backends —
internal/backend/. State storage, the backend init registry, thelocalbackend that wraps everything else. - HCP Terraform / Cloud integration —
internal/cloud/,internal/backend/remote/. Thecloud {}block and remote-operations backend.
Provider plumbing
- Provider installer (
getproviders) —internal/getproviders/,internal/depsfile/,internal/providercache/. Resolution, download, signature verification, the.terraform.lock.hclfile. - Plugin protocol —
internal/plugin/,internal/plugin6/,docs/plugin-protocol/. The gRPC handshake, two protocol versions, host-side wrappers.
Higher-level features
- Stacks —
internal/stacks/. The stack-of-components abstraction and its runtime. - Native test framework —
internal/moduletest/, theterraform testcommand..tftest.hclfiles, mock providers, run lifecycle. - RPC API —
internal/rpcapi/. The gRPC surface that lets external tools (HCP Terraform, IDE plugins) drive Terraform Core directly without invoking the CLI.
Cross-cutting
- Diagnostics, logging, telemetry —
internal/tfdiags/,internal/logging/, OpenTelemetry plumbing inmain.go.
How to read this section
The pages above are written so that you can pick any one and read it in isolation. They link generously to one another and to source code. When the engine or a feature spans multiple subsystems (like ephemeral values, which touch the language, the state, and the plan), follow the cross-links rather than expecting any single page to cover the entire feature.
For the executive summary of how the subsystems fit together, see overview/architecture.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.