ADR 0016 — Infrastructure as code in a dedicated private repository (rettxinfra)
- Status: Accepted (2026-11-13); scope of third-party services amended 2026-11-15
- Date: 2026-11-13
- Decision-makers: rettX maintainers
- Relates to: ADR 0001 (control plane & per-repo ownership), spec 052 (this decision’s implementation spec), spec 047 (credential expiry monitor — unchanged by this decision), spec 059 (app-store listing amendment), program constitution principles II (privacy by design), VI (security baseline), VII (open by default, private only when justified) and VIII (sustainability and stewardship).
Context
Section titled “Context”rettX runs on Microsoft Azure. The production environment was built and configured by hand, and there is one environment: no test or pre-production environment exists. Three consequences follow:
- Knowledge lives in a portal, not in a repo. How production is put together can only be learnt by inspecting it. That contradicts constitution VIII (“knowledge MUST live in the repos, not in the heads of individuals”).
- Changes are unreviewed. An infrastructure change is a portal click with no preview, no second pair of eyes and no history beyond the platform’s activity log.
- There is nowhere safe to try things. Every infrastructure change, and every application change that depends on one, is first exercised in production.
The application repos each deploy their own code, but none of them owns the resources they deploy into. Resource ownership is therefore implicit, and spread across whoever last touched the portal.
Decision
Section titled “Decision”Describe and operate rettX’s Azure infrastructure as code, in a new
private repository, rettxinfra, adopted in phases.
-
Dedicated repository. Infrastructure definitions, environment configuration, the deploy pipeline and the operational documentation (architecture, runbooks, recovery, secrets inventory by name) live in
rettxinfra. They do not live in an application repo. -
Declarative, Azure-native tooling. Azure infrastructure is declared with Bicep. The platform tracks deployed state itself, so there is no separate state file to host, lock and protect. Identity-provider configuration, which Bicep cannot preview, is declared with Terraform (amended 2026-11-15). Its state holds no credentials, so the concern that rejected option C for the Azure estate doesn’t apply to it. Detailed stack choices beyond this belong to
rettxinfra’s own constitution. -
Ownership split.
rettxinfraowns resources, identities, role assignments, and the deploy federation that lets each application repo deploy, and it publishes the outputs those repos need. Application repos keep deploying their own code, into an environment they name at deploy time. -
Phased adoption.
- Phase 1 — adopt. Production is described exactly as it is, under its current names. Adoption is proven when a preview against production reports no changes. Nothing is recreated, renamed or moved.
- Phase 2 — harden. Security improvements are then delivered as
reviewed changes. Their content is tracked privately in
rettxinfra, per constitution VII (“posture vs. gaps”). - Later. Naming and topology changes, if they are ever worth their migration cost.
-
Environments. Production, plus named test environments created and destroyed only on explicit request by a maintainer. They sit in the same subscription as production, isolated from it, and hold synthetic data only. Nothing creates or removes them on a schedule.
-
Scope. rettX only. Other Rett Syndrome Europe properties that share the subscription are out of scope. Third-party services are split by how far they can be safely automated (amended 2026-11-15):
- Identity providers (caregiver sign-in and admin sign-in) are managed as code, through the same preview-and-approved-apply path as the Azure estate. Production configuration is adopted first with no changes, exactly as the Azure estate was.
- Email and push credentials are provisioned by script where the provider allows it, written straight to the secret store and never to the repository. Steps the provider keeps manual stay documented.
- App-store accounts and access, DNS registrar and package registry stay documented, not managed.
- Amendment (2026-11-22, with
spec 059): app-store
listing content is managed as versioned content in the app
repository (
rettxweb), not inrettxinfra. This covers listing text, media, and declarations where the store offers a supported automated interface. It is reviewed by pull request, previewed before apply, and never submits or releases. Store accounts, agreements, team roles, API keys and tester groups stay documented, not managed, and the store identity’s permissions stay withrettxinfra.
Delivered in phases, identity providers first. Each managing credential this adds is held by
rettxinfraalone, with the narrowest permission the provider offers.
Why private (constitution VII record)
Section titled “Why private (constitution VII record)”- Rationale: the definitions name every resource, identity, role assignment and network boundary in production. Publishing them would hand an attacker a map of the estate, which is the justification constitution VII accepts. Public artefacts (this ADR and spec 052) describe the decision and the outcomes only.
- Reviewer: rettX maintainers, on acceptance of this ADR.
- Revisit: 2027-11, or when the other ecosystem repos’ visibility is revisited, whichever comes first.
Options considered
Section titled “Options considered”- Option A — dedicated private repo, Bicep, phased adoption (chosen). Gives infrastructure one owner and one history, keeps sensitive detail out of the public control plane, and uses the platform’s native tooling, which needs no state backend (VIII: boring, well-supported).
- Option B — infrastructure inside the backend repo. Rejected. It couples infrastructure releases to API releases, and it leaves the frontends’ hosting, shared monitoring and shared identities owned by a repo that doesn’t use them.
- Option C — Terraform / OpenTofu. Rejected for now for the Azure estate. It adds a remote state backend to host, secure and back up. That state would itself contain sensitive values, and the portability it offers doesn’t pay off for an estate that is entirely Azure. Adopted on 2026-11-15 for identity-provider configuration only, where Bicep has no preview and the state holds no credentials.
- Option D — document the manual setup only. Rejected. Documentation without enforcement drifts, and it gives neither review nor a test environment.
- Option E — rebuild production cleanly instead of adopting it. Rejected for Phase 1. It risks data and downtime on a live patient registry, for a benefit (tidier names) that can be weighed separately later.
- Option F — a separate subscription for test. Not chosen. It gives stronger isolation, but means more billing, access and identity set-up for a small team. Separate resource groups with no access to production are enough for synthetic-data environments. Revisit if test environments ever need production-like data.
Consequences
Section titled “Consequences”Positive
Section titled “Positive”- Production becomes reviewable, reproducible and recoverable from a repo.
- Every infrastructure change is previewed before it is applied, and production applies need explicit approval.
- Application and infrastructure changes can be tried in a disposable environment before reaching caregivers.
- The admin dashboard gets a defined hosting target in test and production.
Negative / cost
Section titled “Negative / cost”- Another private repository to maintain, with its own constitution and review rules.
- Every portal change after adoption is drift, and is overwritten or flagged on the next deploy. That needs discipline from everyone with portal access.
- Test environments cost money while they exist. Explicit destroy, plus a subscription budget alert, keeps the cost visible (VIII). There is no automatic clean-up, by choice.
- Some managed-service plans are limited per subscription. Test environments are therefore functionally equivalent to production, not identical.
Neutral
Section titled “Neutral”- Application code and runtime behaviour do not change in Phase 1.
- Spec 047’s credential monitor keeps its current home and scope.
Follow-ups (on acceptance)
Section titled “Follow-ups (on acceptance)”- Register the new repo kind. Add
rettxinfratopatterns.md§1 (a new Infrastructure kind) and to the §7 fan-out allow-list. Reflect the same in the fan-out, routing and triage workflows and in the status report. Update the private-repo list in constitution VII’s Current state. This must land before spec 052 is flipped toready, or itsrettxinfraslice is skipped on fan-out. - Create the repository (private) and its constitution.
- Flip spec 052 to
readywhen its open questions are resolved.