All courses / Architecture as Code / Module 1 / Chapter 3
Learning objectives
After the lesson the participant can:
- Distinguish the responsibilities of Architecture as Code and Infrastructure as Code across the chapter's five dimensions.
- Compare mono-repo, multi-repo and hybrid topologies and justify a choice for a given organisation.
- Compare GitFlow and trunk-based development for architecture assets.
- Specify the branch protections and automated checks an architectural repository needs.
Key concepts
- Layered abstraction of AaC and IaC
- Architecture as Code sits one abstraction layer above Infrastructure as Code. It defines the opinionated guardrails that keep architectural intent enforceable, while Infrastructure as Code implements the concrete runtime changes. Version control is the contract between the layers.
- Hybrid topology
- A single canonical repository holds the architectural source of truth (models, policies, ADRs and golden-path templates) while service teams run their own repositories that reference the shared modules and policies. Governance stays centralised without forcing a mono-repo.
- Trunk-based development
- Nearly all work stays on a single main branch, with short-lived feature branches merged within a day or two. It suits architecture assets because definitions should reflect reality continuously, but it depends on reliable automated validation.
- GitFlow with release gates
- Long-lived develop, release and main branches give clear checkpoints for governance sign-off. Teams should codify release gate criteria, such as all ADRs having the status accepted and all diagrams rendering without errors, as automated checks.
- Branch protection for architectural repositories
- Mandatory rules that require status checks (documentation build, diagram generation, infrastructure linting), pull-request reviews, signed commits and linear history, so that architectural artefacts cannot bypass the agreed quality gates.
Interactive exercises
Do them here and get feedback at once. Choose a card and then where it belongs, or drag it.
Interactive exercise 1 · Sort
Architecture as Code or Infrastructure as Code
Sort each statement by the layer it describes in the chapter's comparison of the two.
Interactive exercise 2 · Scenario
Choosing a repository topology
Read the situation and choose what the chapter's reasoning leads to. Each choice gives feedback.
Teaching plan
| 15 min | Teacher presents the comparison table of Architecture as Code and Infrastructure as Code and the idea of version control as the contract between the layers. |
| 15 min | Structured debate: half the room argues for a mono-repo, half for multi-repo, using only the trade-offs the chapter gives. The teacher then introduces the hybrid topology. |
| 10 min | Compare GitFlow and trunk-based development and the conditions under which the chapter prefers each. |
| 25 min | Exercise: participants design the repository topology, layout and protection rules for their own organisation. |
| 10 min | Close on transparency: the four questions an auditable trail answers, and who benefits (leadership, auditors, new team members). |
Discussion
- The chapter says trunk-based development works best when the team trusts its automated validation. What would have to be true of your pipelines before you trusted the main branch at all times?
- What does it change for an auditor when compliance is verified through repository history instead of bespoke documentation?
- Where should the line between the architectural source of truth and the execution artefacts run in your own repositories?
Written exercise
Exercise · 25 minutes
Design an architectural repository
For your own organisation, choose a topology (mono-repo, multi-repo or hybrid) and justify it by scale, team maturity and coupling between components. Sketch the top-level directory layout of the canonical repository, for example architecture, modules and docs, and write for each directory the three things its README must summarise: ownership, usage patterns and change controls. Choose a branching strategy and state where it will be documented. Finally list the branch protection rules and the required status checks that must pass before a merge, and say what evidence each check leaves behind.
Deliverable: A one-page repository design: topology with justification, directory layout with README content, branching strategy, and a list of protection rules and required checks.
Self-test
Choose an answer to see whether it is right, or open the answer below each question.
In the chapter's comparison, what is the primary artefact of Architecture as Code as opposed to Infrastructure as Code?
Show the answer
A. Codified guardrails, architectural policies and structural models
The table gives codified guardrails, architectural policies and structural models as the primary artefact of Architecture as Code; environment templates, resource modules and orchestration logic belong to Infrastructure as Code.Why does the chapter say Architecture as Code workflows generally benefit from trunk-based development?
Show the answer
C. Because definitions are long-lived and should reflect reality continuously
The chapter argues that architectural definitions are long-lived assets that should reflect reality continuously, not periodically, so the canonical model should never diverge far from the development state.What is the principal drawback of a mono-repo that the chapter names?
Show the answer
B. Scale: clone times, CI durations and merge conflicts increase
The mono-repo makes cross-cutting changes atomic and configures shared tooling once; its principal drawback is scale, as clone times, CI run durations and merge-conflict frequency grow with the repository.