Open-Source Wikis

/

Terraform

/

Fun facts

hashicorp/terraform

Fun facts

A few oddities and notable details turned up while building this wiki.

The original commit is older than go modules

The first commit, 649cf336e8 from 2014-05-21, predates Go 1.11 (which introduced modules) by more than four years. The repository has therefore been through every major Go dependency-management transition: vendoring with Godeps, dep, vendor directories, and finally go.mod. The current go.sum has 1,141 entries, all of them produced by the modern Go toolchain.

The DAG package is the oldest unchanged code in the engine

internal/dag/ provides the DAG type that every graph builder writes into and every walker reads from. It has not been substantively rewritten since the early days of the project, despite the engine around it being rewritten twice (HCL2 in 0.12, dynamic module expansion in 1.x). Plenty of files are renamed, refactored, or relocated each year; the DAG type sits underneath them all.

terraform push is a stub that's still in the binary

The push subcommand is registered in commands.go in HiddenCommands. Its implementation in internal/command/push.go is roughly fifty lines that print an error explaining the command is no longer supported. It has stayed there for over six years, surviving multiple cleanup passes, presumably because removing it from the registered commands could break someone's automation that calls it for its non-zero exit code.

The env aliases are still there

The pre-0.10 workspace command was called env. When workspaces were introduced, the original aliases (env list, env new, env select, env delete) were kept as hidden synonyms — see the entries in commands.go. They route to the same WorkspaceListCommand, WorkspaceNewCommand, etc., with a LegacyName: true flag that adjusts a few warnings.

The largest non-test file is meta_backend.go

internal/command/meta_backend.go weighs in at 114,878 bytes — about 3,500 lines. It contains the logic that selects the right backend for an operation, configures it, migrates state between backends, and reconciles user prompts on conflict. It is the single most complex file in the CLI layer; almost any feature that touches "the user changed their backend configuration" lands somewhere in this file or its sibling meta_backend_migrate.go (43,765 bytes).

The test suite has nearly 400 fixture directories for the engine alone

internal/terraform/testdata/ contains 388 subdirectories, each one a tiny Terraform configuration used by an engine test. Adding a new feature to the graph engine almost always means adding two or three more, plus the matching test in one of the context_*_test.go files (the largest of which, context_apply_test.go, is 372 KB).

A custom dependency-tracking library exists just for stacks

internal/promising/ is a small library with its own promise-based dependency tracking, written specifically to support the stacks runtime. It is not used by the main graph walker (which uses internal/dag/), but it is used by internal/stacks/stackruntime/ to coordinate the parallel evaluation of components inside a stack. Two coexisting dependency-tracking primitives is unusual; both exist because the stacks runtime needed dynamic graph structure that the existing DAG type did not naturally support.

The protocol stubs are checked in, not generated at build time

docs/plugin-protocol/tfplugin5.proto and tfplugin6.proto are the source of truth, but the generated Go stubs are committed to the repo (internal/tfplugin5/ and internal/tfplugin6/). Regeneration requires protoc and is wrapped in a separate Makefile target (make protobuf), explicitly because most contributors don't have protoc installed. The wrapper in tools/protobuf-compile/ pins the protoc-gen-go and protoc-gen-go-grpc versions so generated output stays reproducible.

Two protocol versions are supported simultaneously

Terraform Core simultaneously supports plugin protocol v5 and v6. Both have nearly the entire RPC surface independently implemented in internal/plugin/ and internal/plugin6/, and both are dispatched through the abstractions in internal/providers/. Most existing providers still speak v5; v6 is required for the newer features (server capabilities, deferred actions, identity, ephemerals).

The copyright headers in source files use a future date — Copyright IBM Corp. 2014, 2026 — which is a peculiarity of the BUSL license adopted in August 2023 plus the 2024 IBM acquisition. Older files have headers added by the scripts/copyright.sh script. The change-tracking lives in .copywrite.hcl.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Fun facts – Terraform wiki | Factory