Security & FinOps · Plan-time guards
Typos Cannot Reach Production: Declarative SaaS Access with Plan-Time Guards
A Terraform stack maps users, teams, projects and access levels to a managed-database platform, protected by lifecycle preconditions.
// Overview
Users have org roles and team memberships; teams get per-project access levels, and group-style role bundles let a user inherit org roles. A guard resource aborts the plan if an email is in a disallowed domain, a role is not allow-listed, a team or user is unknown or an access level is undefined. Every real resource depends on the guard.
// The problem
Third-party SaaS access is usually granted in a UI, where typos and external addresses are easy to introduce.
// Flow
- Edit access mapusers, teams, projects, levels in config
- Guard evaluation gatepreconditions on domain, role allow-list and references
- Abort or continuefailure stops the plan before any API call
- Teams createdthen invitations and team assignments
- Project accessteam and user grants resolved from levels
- Applythrough the normal pipeline
// Design decisions & guardrails
- Preconditions rather than check blocks, so failure blocks the plan.
- Effective roles are own plus group-derived, de-duplicated.
- Invitations require acceptance before access takes effect.
// Outcome
Invalid access can no longer be planned, let alone applied.