Living documentation#

Documentation rots. This page describes the specific mechanisms used here to make rot either impossible or immediately visible, rather than relying on discipline.

The problem#

Every infrastructure project accumulates a README describing an architecture that has not existed for eight months. The failure is structural, not moral: documentation and configuration live in different files, change at different times, and nothing connects them. The doc is a copy of the truth, and copies drift.

Three mechanisms are used to attack that here.

1. The docs are the website#

There is no separate site content for the architecture pages. The Markdown in docs/ is rendered directly into the published site by site/build.py:

SourcePublished at
docs/01-architecture.md/docs/architecture/
docs/adr/0004-...md/docs/adr/0004-.../
docs/runbooks/bootstrap.md/docs/runbooks/bootstrap/

So the website cannot describe a different architecture than the repository, because there is only one text.

Links between documents are written relative to the source file, so they work when the repository is read on GitHub. The build resolves each one to the page it names and rewrites it to that page's site path, and it fails on a link with no target on the website: a file that is not a published page (code, or a module README), or a fragment that names no heading. Repository paths are therefore written as inline code, not links. Every page footer names the commit it was built from. The deploy passes that commit to the build itself, rather than reading it from state, so a documentation-only deploy names its own commit, and refuses to publish if the footer names any other (ADR-0021).

2. Facts are injected from Terraform state#

Prose is written by hand. Facts are not. The tables describing DNS records, TLS configuration, certificate parameters and DNSSEC settings are generated from tofu output -json site_facts at build time.

In the Markdown:

## The zone as deployed

<!-- FACTS:dns_records -->

The deploy workflow does:

tofu output -json site_facts > facts.json
python3 site/build.py --docs docs --out site/dist --facts facts.json

The site_facts output is assembled in terraform/environments/prod/outputs.tf from the modules' own outputs — module.static_site.security_posture, module.dns_records.record_inventory, and so on. Those in turn are built from the same configuration as the resources. The edge's security_posture goes further: it reads its values back from the planned resources themselves (the viewer policy, IPv6, logging, any web ACL, the bucket's public access settings), so it cannot report a setting the distribution does not have. Until November 2026 three of its values were constants, and could not change whatever the configuration said (ADR-0023). The tests assert on these same outputs, so a test, the output and the published table change together.

The chain is therefore:

flowchart LR
    V["Terraform variables"] --> R["AWS resources"]
    V --> O["Module outputs"]
    O --> F["site_facts"]
    F --> B["build.py"]
    B --> P["Published page"]
    R -.->|"same source of truth"| O
Mermaid diagram source. Renders as a diagram in the repository on GitHub; shown as source here because this site ships no third-party JavaScript.

If someone weakens the CSP, the page claiming the CSP is strict changes in the same commit. It is not possible to weaken the configuration and leave the documentation boasting, because the boast is generated from the configuration.

When facts are not supplied — a local preview, say — the build renders a visible warning rather than silently omitting the table or showing stale values.

3. Generated reference tables, checked for staleness#

Each module's README.md has hand-written prose at the top and a terraform-docs-generated reference table below, between markers.

make docs-check regenerates them and fails if anything changed. So if a variable's description is edited and the README is not regenerated, CI fails. The description and its published form cannot diverge.

This is why tflint's terraform_documented_variables and terraform_documented_outputs rules are enabled: an undocumented variable is a build failure, because the generated docs would have a hole in them.

Architecture Decision Records#

Configuration explains what. It is very bad at explaining what was rejected and why, which is the expensive knowledge — the thing a future reader (including future me) actually needs before changing something.

ADRs in docs/adr/ are immutable once accepted. A decision that changes gets a new ADR that supersedes the old one; the old one stays, marked superseded. The value is in the record of reasoning, including reasoning that turned out to be wrong.

Every non-obvious choice in the Terraform links to its ADR in a comment, so a reader hitting a surprising line finds the reasoning rather than guessing at it.

Runbooks, written before they are needed#

docs/runbooks/ covers the operations that are dangerous or infrequent: bootstrapping, publishing the DS record, rotating the key-signing key, disabling DNSSEC in an emergency, tearing down.

They exist for a specific reason: DNSSEC failures are the highest-severity thing in this stack, and 3am is the worst possible time to be working out the correct order of operations from first principles. The ordering constraints are subtle and getting them wrong extends the outage.

Staying current#

Documentation can also rot by being correct but obsolete — accurately describing a choice that stopped being the best one. The tech radar tracks that explicitly, with a "why not yet" column, and a monthly scheduled workflow opens a review issue against it.

The radar's most useful column is Hold: things deliberately not adopted, with the condition that would change the answer. That is what stops a future reader re-litigating a settled question, and what makes it obvious when a blocker has actually lifted.

What is not automated#

Honest limits:

  • Prose is not verified. Nothing checks that the architecture description

matches reality. The diagrams are hand-drawn Mermaid and can go stale.

  • Mermaid diagrams do not render on the site. They need a ~1MB JavaScript

library, which would mean either a CDN request (blocked by the CSP) or vendoring a dependency into a project whose selling point is having none. The source is shown, labelled, and renders as a diagram in the repository on GitHub.

  • External links are not checked. The build checks every link between

pages, but not links to other sites, which would make the build depend on the network and on other people's uptime.

  • Facts are only as fresh as the last apply. They come from state, and state

changes when terraform-apply runs, not when a pull request merges. A merged change that has not been applied leaves the generated tables describing the previous configuration. In November 2026 this left the site describing a CAA iodef record that had already been removed from the code. Weekly drift detection now opens an issue when production and main differ (runbook), in force since 25 November 2026. It can still take a week to notice, and the site shows the gap until an apply closes it.

Built 2026-11-25 from commit 33bfabf6a27d4baeecf228c31bd5d636a3965070. This page was generated from the same source that provisions the infrastructure it describes.