hashicorp/terraform
7 articles
Prerequisites
- ›Familiarity with Go (interfaces, packages, goroutines)
- ›Basic Terraform user experience (resources, providers, plan/apply workflow)
Terraform's Architecture: A Map of the Codebase
A high-level tour of Terraform's Go monolith: how the binary boots, how its internal packages are organized, and how a command flows from CLI to provider plugin.
The Graph Engine: How Terraform Builds and Walks Dependency Graphs
Dissecting the generic DAG library, the parallel walker, and the transformer pipeline that constructs Terraform's plan and apply graphs.
Planning and Applying: The Resource Instance Change Lifecycle
Following a resource instance through Context.Plan(), graph walking, provider calls, and Context.Apply() — the full lifecycle of an infrastructure change.
The Provider Plugin System: gRPC, Protocols, and Provider Lifecycle
How Terraform discovers, launches, and communicates with provider plugins over gRPC — from the Go interface to the protobuf wire format.
State Management and Backends: Persistence, Locking, and Migration
Terraform's three-tier state architecture, the backend abstraction for state storage, and how state migration works during terraform init.
CLI Layer: Commands, Views, and the Diagnostic System
How Terraform's CLI commands are structured, how the views layer enables human and JSON output, and how tfdiags replaces Go errors with rich diagnostics.
Configuration Loading and Expression Evaluation: From HCL to cty.Value
How Terraform transforms .tf files into executable infrastructure changes through HCL parsing, module tree assembly, and lazy expression evaluation.