Skip to content

MoSCoW Requirements — Deterministic Documentation Example

This document codifies the business and technical requirements for the example deterministic documentation pipeline using the MoSCoW prioritisation method. It is maintained as code alongside the source repository so that CI/CD pipelines can generate traceability matrices linking each requirement to the specific Terraform module, Ansible role, or OPA policy that satisfies it.


Must Have

These requirements are non-negotiable. The system cannot be considered functional without them.

ID Requirement Satisfied By
M-001 Infrastructure must be defined as code (Terraform HCL) terraform/main.tf
M-002 Every resource must carry the four mandatory FinOps cost-allocation tags (environment, app_name, owner, cost_center) policies/terraform/deny_missing_tags.rego
M-003 OPA policy violations must block the CI/CD pipeline before terraform apply .github/workflows/docs-pipeline.yml — OPA gate step
M-004 Terraform documentation must be auto-generated by terraform-docs; no hand-written input/output tables are permitted scripts/generate-docs.sh
M-005 All significant architectural decisions must be recorded as ADRs in docs/adrs/ docs/adrs/0001-*.md, docs/adrs/0002-*.md, docs/adrs/0003-*.md
M-006 The complete documentation site must be buildable from a single Docker image with no host dependencies Dockerfile
APP-001 .NET API documentation must be auto-generated by DocFX; no hand-written API reference is permitted dotnet/docs/docfx.json, dotnet/dotnet-tools.json
APP-002 .NET architecture policy violations must block the CI/CD pipeline before the documentation build dotnet/tests/MyApp.ArchitectureTests/, .github/workflows/docs-pipeline.yml — dotnet-test job
APP-003 All .NET projects must enforce code-quality rules via Roslyn analyzers with TreatWarningsAsErrors dotnet/Directory.Build.props, dotnet/.editorconfig
APP-004 The .NET application must have a deterministic, reproducible build dotnet/global.json, dotnet/Directory.Build.props (Deterministic, ContinuousIntegrationBuild)

Should Have

Important requirements that add significant value but have a known workaround if omitted from the current iteration.

ID Requirement Satisfied By
S-001 OPA policies must include self-describing __rego__metadoc__ blocks so compliance reports are human-readable policies/terraform/*.rego
S-002 OPA policy unit tests must achieve 100 % rule coverage policies/terraform/*_test.rego
S-003 Ansible playbook must use setup module to gather live host facts and render them via Jinja2 templates ansible/playbook.yml, ansible/templates/host-report.md.j2
S-004 MkDocs site must include a searchable ADR index and a compliance chapter mkdocs.yml nav section
S-005 The CI/CD pipeline must publish the MkDocs site to GitHub Pages on every merge to main .github/workflows/docs-pipeline.yml — deploy step
S-006 Full traceability chain (OPA policy → ADR → MoSCoW requirement) must be machine-readable and rendered as diagrams __rego__metadoc__ related_adr/related_requirements fields; ADR front-matter; docs/traceability/index.md
S-007 Backstage catalog-info.yaml must be present so the component is discoverable in any Backstage developer portal catalog-info.yaml, backstage/app-config.yaml, Dockerfile.backstage
S-008 PowerShell DSC resources must be implemented as class-based modules with comment-based help, and documentation auto-generated by DscResource.DocGenerator dsc/resources/DTDS_FileContent/, dsc/build.ps1, docs/generated/dsc-resources.md
S-009 DSC resource unit tests must validate Get/Test/Set idempotency contract using Pester 5 dsc/tests/DTDS_FileContent.Tests.ps1

Should Have — Cybersecurity

ID Requirement Satisfied By
CYB-001 Architecture overview page with C4-style diagrams (C4Context, C4Container, C4Component) and technology radar docs/architecture/index.md
CYB-002 OPA policy must block publicly exposed resources (S3 public ACL, security group open to 0.0.0.0/0 on sensitive ports, Azure public blob) policies/terraform/deny_public_access.rego
CYB-003 OPA policy must block overly permissive IAM (wildcard principals, wildcard actions on sensitive services) policies/terraform/deny_public_iam.rego
CYB-004 OPA policy must block unrestricted network egress and non-RFC-1918 subnet CIDRs policies/terraform/deny_unrestricted_network.rego
CYB-005 Security controls matrix must map every OPA policy to CIS benchmark, NIST 800-53, and SOC 2 CC controls docs/security/index.md

Should Have — Architects

ID Requirement Satisfied By
A-001 Architecture overview with C4 Context + Container + Component Mermaid diagrams docs/architecture/index.md
A-002 Technology radar table documenting every tool's adoption ring docs/architecture/index.md
A-003 Quality attribute scenarios (ISO 25010) linked to implementation artefacts docs/architecture/index.md
A-004 Architecture decision recorded for diagram toolchain choice docs/adrs/0005-architecture-documentation.md

Should Have — DevOps Operational

ID Requirement Satisfied By
OPS-001 Operational runbook with incident response flowchart and escalation matrix docs/runbook/index.md
OPS-002 Network topology documented as code with subnet allocation, NSG rules, and DNS records terraform/network.tf, docs/network/index.md
OPS-003 Network topology auto-generated as Markdown during terraform plan terraform/network.tf → docs/generated/network-topology.md
OPS-004 Infrastructure drift detection: scheduled terraform plan -detailed-exitcode comparison between deployed state and code, failing the pipeline with a human-readable diff scripts/generate-drift-report.py, drift-check job in .github/workflows/docs-pipeline.yml

Should Have — Documentation Governance

ID Requirement Satisfied By
D-001 A CI gate must fail the build when infrastructure or policy code is changed without a corresponding documentation update scripts/check-doc-coverage.sh, .github/workflows/docs-pipeline.yml → doc-coverage job
D-002 Documentation coverage rules must be version-controlled alongside the source code they govern scripts/check-doc-coverage.sh

Should Have — Versioning & Changelog

ID Requirement Satisfied By
V-001 The repository must use a single source-of-truth version file (version.txt) read by CI, Docker builds, and the MkDocs footer version.txt
V-002 The CI pipeline must tag git commits with v<version> on every version bump and create a corresponding GitHub Release .github/workflows/docs-pipeline.yml → release job
V-003 A machine-generated CHANGELOG.md must be produced from conventional-commit history using git-cliff; no hand-written release notes are permitted cliff.toml, .github/workflows/docs-pipeline.yml → release job

Should Have — FinOps

ID Requirement Satisfied By
FIN-001 FinOps persona page must document tag policy, the OPA enforcement gate, and a resource cost-centre mapping table docs/finops/index.md
FIN-002 All Kubernetes workloads must carry the same four cost-allocation labels enforced on Terraform resources policies/kubernetes/deny_missing_labels.rego (K8S-003)
FIN-003 A cost-anomaly runbook section must document how to detect and remediate tag violations in CI and in production docs/finops/index.md

Should Have — Kubernetes

ID Requirement Satisfied By
K-001 Kubernetes manifests must be provided as both raw YAML and a Helm chart kubernetes/, helm/
K-002 OPA policy must block Kubernetes containers that do not declare CPU and memory limits policies/kubernetes/deny_missing_resource_limits.rego (K8S-002)
K-003 OPA policy must block Kubernetes containers that run as privileged or allow privilege escalation policies/kubernetes/deny_privileged_containers.rego (K8S-001)

Should Have — Developer Experience

ID Requirement Satisfied By
DEV-001 A developer onboarding guide must enable a new team member to run the full local pipeline in under 15 minutes with no host tool installation docs/onboarding/index.md
DEV-002 Commit message format (Conventional Commits) must be documented alongside the versioning strategy docs/versioning/index.md
DEV-003 The repository map in the onboarding guide must be a Mermaid diagram generated from the actual directory structure docs/onboarding/index.md

Should Have — AI & MCP Integration

Requirements related to exposing the platform to AI agents via the Model Context Protocol (MCP).

ID Requirement Satisfied By
AI-001 The Backstage catalog must be queryable by AI agents via a standardised MCP interface without custom per-model integration code backstage/mcp-clients/, .vscode/mcp.json, ADR-0009
AI-002 The Backstage catalog must include at least one System, one API, one Group, one User, two Components, and two Resources so AI agents have a rich, traversable entity hierarchy to explore catalog-info.yaml (7 entities)
AI-003 VS Code / GitHub Copilot MCP configuration must be committed to the repository so any developer cloning the repo gets AI catalog access immediately .vscode/mcp.json
AI-004 The TDS determinism boundary is documented: deterministic-generated vs human-authored vs AI-assisted content classes with guardrails, and AI as a read-only consumer via MCP docs/architecture/ai-boundary.md, ADR-0025

Should Have — DORA Compliance (EU 2022/2554)

Requirements derived from the Digital Operational Resilience Act (DORA), applicable to financial entities and their critical ICT third-party service providers from 17 January 2025. DORA is lex specialis over NIS2 for financial entities. See ADR-0011 for the compliance strategy decision.

ID Requirement DORA Article Satisfied By
DORA-001 An ICT risk management framework must exist and be version-controlled; every significant ICT risk-management decision must be recorded as an ADR traceable to requirements Art.5–6 docs/adrs/, docs/requirements/moscow.md, docs/compliance/dora.md
DORA-002 CloudTrail audit trails must have log-file integrity validation enabled; OPA must block deployments without this setting Art.9, Art.10 policies/terraform/deny_dora_ict_risk.rego (DORA-ICT-001)
DORA-003 CloudWatch log groups must define an explicit non-zero retention period; S3 backup buckets must have versioning enabled Art.10, Art.12 policies/terraform/deny_dora_ict_risk.rego (DORA-ICT-001)
DORA-004 ICT incident handling procedures must be documented, classified, and include DORA-compliant notification timelines (initial 4h, intermediate 72h, final 1 month) Art.17–20 docs/runbook/index.md
DORA-005 A digital operational resilience testing programme must exist; automated policy tests must maintain 100% rule coverage Art.24–25 policies/terraform/*_test.rego + policies/kubernetes/*_test.rego (90 OPA unit tests), dsc/tests/*.Tests.ps1
DORA-006 ICT third-party risk must be acknowledged; cloud provider relationships must be scoped in the requirements document Art.28–30 W-001 — local provider demo; contractual provisions for real deployments

Should Have — NIS2 Compliance (EU 2022/2555)

Requirements derived from the NIS2 Directive Article 21 cybersecurity risk-management obligations. These apply to essential and important entities in scope from 17 October 2024. See ADR-0010 for the compliance strategy decision.

ID Requirement NIS2 Article Satisfied By
NIS2-001 Evidence of security risk analysis and information system security policies must be version-controlled and traceable to implementation artefacts Art.21(2)(a) docs/requirements/moscow.md, docs/adrs/, docs/compliance/nis2.md
NIS2-002 Cryptography policy must prohibit weak algorithms and require key rotation; enforcement must be automated in the CI/CD pipeline Art.21(2)(h) policies/terraform/deny_unencrypted_storage.rego (SEC-001), policies/terraform/deny_deprecated_tls.rego (SEC-006), policies/terraform/deny_nis2_crypto.rego (NIS2-CRYPTO-001)
NIS2-003 Business continuity, backup and disaster-recovery capability must be documented and its configuration managed as code Art.21(2)(c) terraform/storage.tf (backup bucket + replication), terraform/monitoring.tf (backup alarms), docs/runbook/index.md
NIS2-004 Access control must enforce least-privilege; no wildcard IAM principals or actions on sensitive services Art.21(2)(i) policies/terraform/deny_public_iam.rego (SEC-003), terraform/iam.tf
NIS2-005 Incident handling procedures must be documented, including detection, response, and recovery steps Art.21(2)(b) docs/runbook/index.md
NIS2-006 The effectiveness of all security risk-management measures must be measurable and regularly assessed; automated test coverage must be maintained Art.21(2)(f) policies/terraform/*_test.rego (63 OPA unit tests), scripts/check-doc-coverage.sh, .github/workflows/docs-pipeline.yml
NIS2-007 Supply chain security must be enforced in CI/CD: Terraform providers and modules must be pinned to immutable, verified versions; container images must not use mutable tags (:latest or untagged) Art.21(2)(d) policies/terraform/deny_nis2_supply_chain.rego (SC-001), policies/kubernetes/deny_unpinned_image_tag.rego (K8S-004)

Should Have — Application Layer (.NET)

Requirements for the .NET application layer that extends the deterministic documentation pipeline from infrastructure code to application code (see the .NET ADR series, ADR-0013 through ADR-0017).

ID Requirement Satisfied By
APP-005 The OpenAPI document must be generated at build time by the native ASP.NET Core toolchain (no Swashbuckle runtime reflection) and rendered in the TDS dotnet/src/MyApp.Api/ (Microsoft.AspNetCore.OpenApi), scripts/generate-openapi-docs.py
APP-006 Architecture diagrams must be generated from code via C4Sharp — the C4 model as code, rendered to Mermaid dotnet/tools/MyApp.Architecture.Diagrams/, scripts/generate-c4-diagram-docs.py
APP-007 .NET architecture policies must include self-describing metadata (Policy.Define) so compliance reports are human-readable dotnet/tests/MyApp.ArchitectureTests/ArchitecturePoliciesTests.cs, scripts/generate-dotnet-policy-docs.py

Could Have

Desirable enhancements that are deferred to a future iteration.

ID Requirement Notes
C-001 Auto-generate C4-model architecture diagrams from .tfstate using Infragram Requires VS Code extension or standalone CLI
C-002 Grafana SLO resources defined in Terraform (grafana_slo) to feed the observability chapter Requires Grafana Cloud or self-hosted Grafana
C-003 Threat model auto-generated via IriusRisk API from Terraform templates Requires paid IriusRisk licence
APP-008 Client SDK generation from the build-time OpenAPI document (NSwag) Deferred — revisit when a consumer needs a typed client

Won't Have (in this iteration)

These requirements are explicitly out of scope. Documenting them here protects against unauthorised scope creep.

ID Requirement Rationale
W-001 Real cloud resource provisioning (AWS, Azure, GCP) This example uses the local provider to avoid credential management
W-002 Multi-tenancy or RBAC for the developer portal Single-team scope; revisit when Backstage is adopted (C-002)
W-003 Runtime configuration management via Ansible against live hosts Example uses static inventory; live targets require SSH access