ADR-0016: Seed from GitHub Actions with a temporary, self-removing IAM user#
- Status: accepted
- Date: 2026-11-24
Context#
Phase 0 (ADR-0014) creates the GitHub OIDC provider and the first role GitHub can assume. Until it exists, a workflow has no keyless way into the account. Running phase 0 from a laptop keeps keys out of the picture, but leaves the one step that establishes trust outside the repository's audit trail: no run log, no plan in a summary, no record of who ran what.
The owner wants every phase, phase 0 included, to run in GitHub Actions.
Decision#
Phase 0 runs in the seed-account workflow with a temporary IAM user's access key, and the same run removes the user.
The key is bounded five ways:
- Scope. Its inline policy covers exactly what the seed creates (the
OIDC provider, testz-gha-bootstrap, the state bucket) and only the seed/ state key.
- Time. The policy denies everything after an
EXPIRES_ATset a few hours
ahead, so the key dies even if cleanup never runs.
- Exposure. It is stored as secrets of the
bootstrapenvironment, passed
only to the steps that need it, never exported to the job.
- Removal. After the seed, the run switches to the role it just created,
over OIDC, and deletes the user, its key and its policy. A user cannot do this to itself: DeleteUser requires its policies removed first, after which it has no permission left. The bootstrap role may delete testz-seed-* users and nothing else.
- Proof. The run then calls AWS with the old key and passes only on
InvalidClientTokenId.
The GitHub secrets remain until a person deletes them; GITHUB_TOKEN cannot. They are inert by then.
Running phase 0 from a laptop stays supported for anyone who prefers no key at all.
Alternatives considered#
Laptop only. No key ever exists, but the trust-establishing step has no audit trail and depends on one machine's setup.
A key that the user deletes itself. Fails: once its policies are removed it cannot call DeleteUser, and while they remain DeleteUser refuses. Something else has to finish, and the role the run just created is the natural candidate.
An organization-level role that creates the seed (the earlier draft of ADR-0014). Keyless, but ties every account to AWS Organizations and gives one CI role administrator access to all of them.
Consequences#
Positive: every phase runs from the repository with a log and a reviewed plan. The key's useful life is minutes, and hours at worst.
Negative: a long-lived credential briefly exists, an exception to ADR-0006. The bootstrap role gains permission to delete testz-seed-* users. Changing the seed later needs a new temporary user each time, deliberately: nothing in CI can change the seed otherwise.
Neutral: creating the user and setting the secrets are manual console steps; that is the trust being established.
Status notes#
- 2026-11-25. *Changing the seed later needs a new temporary user each
time* turned out broader than needed. The first change to the seed, one condition on the bootstrap role's trust policy (ADR-0019), was made by the account owner in the IAM console, matching code that had already been reviewed and merged. No key was created. The decision above stands for seeding an account and for any change whose plan should be read first. The trust runbook says which changes take which path. Nothing in CI can change the seed either way.
Revisit when#
- GitHub can delete environment secrets from a workflow token, which would let
the run clean up the secrets too.
- AWS offers a way to grant a fresh account's first role without any
credential, which would remove the need for the user.