SR-INFRA-006 — Declarative Role Specifications: System Requirements
By Engineering Team•October 20, 2026•3 min read
| Metadata | Details |
|---|---|
| System Name | Declarative role specifications |
| Document ID | SR-INFRA-006 |
| Author | Engineering Team |
| Status | Draft / Implementation |
Traces back to BRD-INFRA-006. Implements workspace rule 10 sections 1, 3 and 5.
1. Functional System Requirements
| ID | Description | Traceability (BRD) |
|---|---|---|
| SR-F-01 (Roles in Code) | Every role, API token and permission binding is declared in OpenTofu, in concern files such as roles.tf and pipeline_access.tf, and changed through a pull request. |
BR-1.1 |
| SR-F-02 (One Identity per Role) | Each role, runner and person has its own identity, named per SR-INFRA-007. An identity is never shared. | BR-1.2 |
| SR-F-03 (Least Privilege From Code) | A role holds exactly the permissions its module’s resources need, scoped to one account or zone. A permission is added only when a plan reports it missing, and removed in the same pull request that removes its resource. |
BR-1.2 |
| SR-F-04 (Lookup, Not Copy) | Permission identifiers are looked up by name with data sources and the plan fails when a lookup misses. Console-copied IDs are not used. | BR-1.1 |
| SR-F-05 (Console Read-Only) | After bootstrap, interactive console write access is not used for roles or permissions. A console edit is drift. | BR-1.1, BR-1.4 |
| SR-F-06 (No Escalation) | No workload or pipeline role may create, change or grant identities, tokens or roles. Only the bootstrap credential may. | BR-1.2 |
| SR-F-07 (Drift Check) | tofu plan flags permissions changed outside the code. The next apply reverts them. A plan is run before every production apply. |
BR-1.4 |
2. Non-Functional & Security Requirements
| ID | Specification | Traceability (BRD) |
|---|---|---|
| SR-NF-01 (Expiry) | Every credential has an expiry, checked at plan time; the lifetime of each role is in SR-INFRA-009 SR-NF-08. | BR-1.2 |
| SR-NF-02 (Review) | The role table is checked against the code whenever a module changes and at each rotation. | BR-1.3 |