ADR-INFRA-011 — Setup Layer and Credential Hierarchy
Status: Accepted Date: 2026-10-25 Authors: Engineering & Security Architecture Team
Context
ADR-INFRA-005 defines one bootstrap module that creates the state bucket and the pipeline credentials. With two environments sharing one account (ADR-INFRA-010), the code that creates each environment’s bucket and deployer credential must itself be a privileged module, because creating a credential needs the token-management permission. Workspace rule 10 allows exactly one hand-created credential and bars every deployer role from creating credentials. The decision is how to place that second privileged step so the rule still holds, and which credential each workspace may use.
Decision Drivers (FRs & NFRs)
- BRD-INFRA-009 BR-1.2 and BR-1.3 — a fixed order, and the right access for the right job.
- SR-INFRA-009 SR-F-01 to SR-F-04, SR-F-07, SR-F-08 and SR-NF-06.
- SR-INFRA-005 — bootstrap credential lifetime and revocation.
- Workspace rules 10 and 12 — one privileged credential, no credential in a workspace.
Decision — How the layers and their credentials are arranged
Option 1 — One bootstrap module creates everything for both environments
Pros:
- One privileged module, one state and one passphrase.
- Matches the current single-environment layout.
Cons:
- The one privileged credential would also create zone settings and workload-adjacent resources, so the privileged module grows with every environment.
- Adding an environment means re-running the most privileged step.
- No separation between preparing the account and preparing an environment.
Option 2 — Four layers; bootstrap and project-setup are privileged, applied by a person only (CHOSEN)
Pros:
- Each layer creates only what the next one needs. Bootstrap makes the project-setup layer’s state bucket and credential. Project-setup makes each environment’s bucket, state-access credential and deployer credential. The environment layers declare workload resources only.
- Both privileged modules sit outside every pipeline path filter, with their own state key and passphrase, so rule 10 section 2 holds for both.
- The privileged credential for a layer is short-lived and is not stored, so a leaked deployer credential cannot create credentials.
- Adding an environment means a change to the project-setup layer only.
- The
op://reference template and vault per layer make the layer boundary visible in review.
Cons:
- Rule 10 section 6 describes one hand-created credential. This design needs one per privileged layer, so the rule’s wording needs a note that a second privileged module follows the same policy. The credential still expires in a day and is still created by hand.
- Two privileged applies instead of one for first-time setup.
- More modules and state keys to maintain.
Option 3 — Workspaces receive credentials as environment variables
Pros:
- Plan and apply can run inside the workspace, with no Mac step.
- Closest to how a hosted workspace usually works.
Cons:
- A credential value sits in the workspace’s environment, where any process in it, including an assistant, can read it. This breaks workspace rule 12.
- A rebuilt or shared workspace can keep the value longer than the credential’s intended life.
Final Decision
Use four layers. The bootstrap and project-setup layers are privileged modules applied with a short-lived, hand-made credential: by a person from the layer’s dev container, or, for production project setup, by its manual workflow. The two environment layers use deployer credentials that cannot create credentials. Every layer reads its values from its own vault, so a workspace holds the code and the toolchain for its layer and never a credential. Option 1 is rejected because the privileged module would grow with every environment. Option 3 is rejected because it puts values in the workspace.
The cost accepted is a second privileged step and a note on rule 10 section 6. A workspace is a place to work, not a barrier: the controls that keep a layer from reaching another are the token scope and the vault split, not the workspace itself.