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

Starred pages

Pages

Page directory · Labels · [ hides this

ADR-0024 accepted

The pipeline deploys through CloudFormation's own role in each account

  • Status: Accepted; amended by ADR-0037
  • Date: 2026-10-06

Context

HKB's deployment pipeline makes changes in other AWS accounts. AWS's standard way to do that uses two separate roles in each account: one the pipeline uses to start a change, and one that CloudFormation, AWS's infrastructure-as-code service, uses to actually build the resources. Splitting them means the pipeline itself never holds the power to create things directly.

As first built, HKB's pipeline had only the first kind of role, so it couldn't use the standard CloudFormation deploy step at all. The choice was to add the missing roles, or replace the standard step with custom scripts.

Decision

Follow AWS's pattern. Each account the pipeline deploys to gets a dedicated CloudFormation role that does the building. The pipeline's own role is cut back to starting changes and handing them over.

Every role in HKB must carry a permissions boundary, a cap on what it can ever be granted. The boundary for pipeline roles didn't exist yet, so each new role was logged as a dated exception until it did.

Consequences

  • Every change is still previewed as a change set before it runs, and approvals stay inside the pipeline.
  • Three more roles to review.
  • Later, ADR-0037 took the pipeline out of the management account entirely, so the roles there were removed.

Alternatives considered

  • Custom deploy scripts in a build step. Fewer roles, but hand-written code at the heart of the pipeline. AWS would also no longer see the changes as coming through CloudFormation, which one of HKB's guardrails relies on.
LLMs look here
  • Records D66, from DQ-01. Amended by ADR-0037 (D83): hkb-pipeline-cfn-scp and hkb-master-org-deployer are removed, and no pipeline action targets master.
  • The CodePipeline CloudFormation deploy action has two roles: the action role, which CodePipeline assumes in the target account, and the configuration RoleArn, which CloudFormation uses. RoleArn is required for create, update and delete, and must be in the same account as the action role.
  • As built: hkb-master-org-deployer held the Organizations write actions itself with no iam:PassRole, and hkb-pipeline-self could not pass a CloudFormation role.
  • Roles decided:
  • hkb-pipeline-cfn-self in Shared Services, for the pipeline's self-update.
  • hkb-pipeline-cfn-scp, for SCP and RCP stacks.
  • hkb-master-org-cfn in master, holding the Organizations write actions, for the two pipeline-deployed master policy stacks only (hkb-org-mgmt-policies, hkb-org-declarative), never identity or alerts.
  • hkb-master-org-deployer shrinks to change-set actions plus iam:PassRole on hkb-master-org-cfn.
  • Each new role is a GR-02 exception with an expiry until it carries hkb-pipeline-boundary (ADR-0036).
  • D65's rule that manual master stacks use no service role (so aws:CalledVia reaches the MasterAdmin guardrail) is untouched; it is about hand-run stacks. A CodeBuild stage's API calls would carry no aws:CalledVia: cloudformation.
  • Cost at the time: two reviewed change sets to roles already applied.

Page information

Owner
Platform Engineering
Status
accepted From the decision record.
Generated from
docs/adr/0024-native-cloudformation-actions-with-service-roles.md
Linked from
Findings review, Decisions