Architecture as Code · Whitepaper

Chapter 9C · Security and Governance

Risk and Threat Modelling as Code

Key insights from Chapter 9C of "Architecture as Code"

Author Gunnar Nordqvist
Published 23 October 2025
Build number 2025.10
diagram-refresh governance-automation ai-collaboration
Risk and threat modelling overview showing automated risk registers, threat playbooks, and continuous enforcement pipelines
Risk and threat modelling overview showing automated risk registers, threat playbooks, and continuous enforcement pipelines

Architecture as Code programmes already encode infrastructure, policy, and security controls. Extending the repository to cover risk registers and threat playbooks makes the entire resilience posture transparent and repeatable.

Structure risk definitions as declarative YAML or JSON documents that capture context, probability, impact, and ownership, mirroring the likelihood-and-impact vocabulary of NIST SP 800-30 Source [83]. Version control provides historical records of changing assumptions and facilitates independent review. Treat the schema as a contract that automated tooling validates during pull requests.

statement: "Loss of regional database cluster availability disrupts customer journeys"

Primary topics explored

  1. Why risk and threat handling belong in the codebase
  2. Engineering a risk-as-code model
  3. Threat handling as code
  4. Integrating with the delivery pipeline
  5. Operating model considerations
  6. Sources

About Architecture as Code

Infrastructure as Code represents a fundamental change in how we manage and develop IT infrastructure. This book provides organisations with practical guidance for implementing IaC principles whilst fulfilling local compliance requirements and optimising costs.

The book covers everything from fundamental principles and tools to advanced implementation strategies, security aspects, and organisational changes required for successful IaC adoption.

Who should read this

IT architects, DevOps teams, developers, and decision-makers within organisations.

Portrait of Gunnar Nordqvist

Gunnar Nordqvist

Conceived, directed and published the books of The Transformed Architecture.

Continue with the full chapter

Read the full chapter online

Chapter 9C: Risk as Code and Threat Handling as Code in Architecture as Code gives the detailed explanations, practical examples and implementation patterns behind this summary.

This whitepaper belongs to “Security and Governance” and is one of 38 drawn from the manuscript.