ADR-0025 accepted
Account IDs stay out of the code and are looked up when it deploys
Context
HKB has a firm rule: no account IDs or organization IDs in the repository. They aren't secrets exactly, but they help an attacker map the environment, and the repository may one day go public.
Yet many templates need those IDs to work. The very first stacks the pipeline deploys need the organization's ID. The question was how a template gets an ID it isn't allowed to contain.
Decision
- Store the IDs in AWS's own parameter store, inside the accounts themselves. Kyle fills in the values when he applies the setup, and they're never printed or saved to the repository.
- Templates ask for a parameter by its name instead of containing the value, and AWS fills it in when the change is previewed.
- Every account uses the same naming layout for its parameters, and a copy is delivered to each account, because a template can only read parameters in its own account.
Consequences
- No IDs in the repository or the pipeline, and nothing new to run.
- Switching an existing stack over should change nothing in AWS, and the first switch was proven that way before anything depended on it.
- The parameter names become a shared contract, so renaming one is a reviewed change across templates.
- When an account is added, every copy has to be updated together. The rollout handles that automatically.
Alternatives considered
- A pipeline step that looks the IDs up before each deploy. It would need read access to the organization from an account that's deliberately denied it.
- Committing the IDs. That breaks the rule.
LLMs look here
- Records D67; catalog layout amended by D82 (Kyle 2026-10-06).
- Two parameter stacks:
hkb-org-params(master) andhkb-pipeline-params(Shared Services), IDs as SSM String parameters. - Templates change
Type: StringtoType: AWS::SSM::Parameter::Value<String>with the path asDefault. CloudFormation resolves these in the stack's own account and Region at change-set creation; the deploying role needsssm:GetParameters. A template converts when it joins the pipeline. RootIdis needed by the first two pipeline stacks; eleven more templates needed OU, org or account IDs with no default.- Catalog paths:
/hkb/aws/org/...and/hkb/aws/account/<name>/..., account-level facts only. From Stage 3 a Shared Services StackSet delivers the catalog to every member account, with a master-local copy. - Rejected: a CodeBuild Resolve stage writing a template configuration (needs Organizations read from Shared Services, which the Validate role is denied).
Page information
- Owner
- Platform Engineering
- Status
- accepted From the decision record.
- Generated from
docs/adr/0025-ids-reach-templates-as-ssm-typed-parameters.md- Linked from
- Decisions