latest run 54 pass 0 fail 0 skipevidence →
HKB Operations: pages
HKB OperationsKnowledge space

Starred pages

Pages

Page directory · Labels · [ hides this

ADR-0002 accepted

Build everything with AWS's own tool, CloudFormation

  • Status: Accepted
  • Date: 2026-09-30

Context

HKB is built as code: every account setting, role and guardrail is written in files and deployed by a pipeline, not clicked together in the console. That needs one infrastructure-as-code tool, and the choice shapes everything after it.

The main options were Terraform, the most popular tool across clouds; CDK, which writes infrastructure in a programming language; and CloudFormation, AWS's own. HKB is AWS only and security-led. Every control should map to something an auditor can read and a pipeline can enforce, and the baseline has to reach many accounts and Regions at once.

Decision

Use CloudFormation as the only infrastructure-as-code tool. Its companion, CloudFormation Guard, checks templates against policy rules before they deploy, and a linter checks them for mistakes.

Consequences

  • CloudFormation's built-in features line up with governance controls: every change is previewed and approved before it runs, one template can be rolled out to every account, and drift from the code can be detected.
  • The previewed change is stored as the record of what changed.
  • One limit: templates rolled out to every account can't use shorthand features, so they're written out in full.
  • Templates are longer than CDK code, and they're reviewed exactly as written.

Alternatives considered

  • Terraform. A strong ecosystem, but it keeps its own record of what exists (a second source of truth to protect), and it has no native way to roll out to every account in an organization.
  • CDK. Concise, but it generates the templates in a build step, so what's reviewed isn't exactly what's deployed.
LLMs look here
  • Records D1. Tools: AWS CloudFormation, CloudFormation Guard (policy as code) and cfn-lint.
  • Governance mapping: StackSets, change sets, Guard and stack drift detection give reviewable change records, preventive checks and drift evidence. The pipeline stores change sets as the change record.
  • Service-managed StackSets don't accept templates that use transforms or macros (verified 2026-10-05), so StackSet templates are plain CloudFormation. SAM remains possible for stacks the pipeline deploys directly.
  • Terraform was rejected as a second state system with no native StackSets or Organizations delegation story.

Page information

Owner
Platform Engineering
Status
accepted From the decision record.
Generated from
docs/adr/0002-cloudformation-plus-guard.md
Linked from
Decisions