Overview
Curated: · Written: · Reviewed:
Self-Service Infrastructure
In one line
Self-service infrastructure lets an authorized team provision, change, inspect and retire supported resources through an API, CLI, portal or declaration, with authorization and policy enforced by the platform instead of a ticket queue. Reach for it when the journey is common, supported and bounded enough to templatize.
Key definitions
- Golden path: a small set of fully supported templates for the common case.
- Escape hatch: a time-bound, justified, audited route for anything off the path.
- Plan-time policy: rules evaluated against the rendered plan JSON before apply.
- Confused deputy: a caller names a resource it may not touch, and the orchestrator's broader privilege reaches it.
- Reconciler: a scheduled job that compares declared state with provider reality and corrects platform-owned fields.
How it works
- The requester sends only the intent the platform cannot infer. The server authorizes against team, environment and resource class before anything else runs.
- Schema validation runs at request time. The template renders at a pinned version.
- A planner role produces a plan. Plan-time policy reads the plan JSON. Approval gates apply where policy requires them.
- A separate applier role with its own short-lived session applies that exact plan. The record stores the provider run id and session id.
- The reconciler checks drift, TTL and ownership on a schedule.
When to use and when not to
| Condition | Self-service | Human review or stronger path |
|---|---|---|
| Journey is common and repeated | Yes | One-off design work |
| Blast radius is bounded (dev database, ephemeral environment) | Yes | Production deletion and data moves need stronger authorization |
| Rule has a plan-time or admission check with a fix message | Yes | Judgment calls with no remediation path |
| Cost and destructive effects are visible to the requester | Yes | Hidden cost or durability effects |
| Arbitrary resource creation in any cloud account | Never | Privilege concentrates in one identity |
Traps interviewers probe
- Matching one action value. A rule that flags
actions == ["delete"]misses replacements. Terraform records a replace as["delete","create"], or["create","delete"]whencreate_before_destroyis set. Fix: flag any change whose actions includedelete. - Defaulting a sensitive field. A default data classification put cardholder data under weak controls for 90 days. Fix: make the field required and reject requests that omit it.
- Treating local state as durable. A state file on one laptop is lost with the disk, and the resources it tracked keep running unmanaged. Fix: use a remote backend with versioning and locking, then recover from a backup or re-adopt resources with
terraform import. - Giving plan runs apply power. Plans execute configuration code, including code from pull requests. Fix: plans get read-only, short-lived credentials, and the applier is a different role that runs only from protected branches.
- Retrying a non-idempotent call. A client that retries
POST /transfersafter a timeout can move money twice. Fix: require anIdempotency-Keyand return the original result for a repeated key. A 202 response means accepted for async processing, not settled.
Interview tips
Opening: self-service removes the ticket and the human approver for the common case. It does not remove governance. Governance moves into product design, authorization, policy, evidence and lifecycle operations.
Terraform specifics to quote:
- Changing
amionaws_instanceforces replacement, so the plan shows-/+. Addingaws_eipis a plain create. - Several instances from one block: with
count, removing an element shifts the indices and can replace the wrong instances.for_eachkeys each instance by a stable name. - Two engineers on an S3 backend: state locking serializes applies. The older mechanism is a DynamoDB table set with
dynamodb_table. Terraform 1.10 and later can lock with a lock file in S3 viause_lockfile = true. Say which version you assume. - A killed CI apply can leave the lock held. Confirm no run is still active, check the state for a half-applied resource, then run
terraform force-unlock <LOCK_ID>.
Admission and break-glass: an override is time-bound, names the approver, emits an audit event and expires on its own. Policy failures return the rule, the affected object and the fix.
Follow-ups to expect: drift, cancellation during apply, a stuck state lock, a policy service outage, break-glass access, safe deletion, state recovery, and how you measure success.
30-second outline:
- Define the boundary: a supported journey, an eligible cohort, and what the platform will not do.
- Minimal intent in. Authorization and validation run server-side.
- Three gates: request time, plan time, admission time. Each returns the rule, the affected object and the fix.
- Separate credentials per actor, each short-lived.
- Lifecycle: status records, TTL, ownership, reconciliation, and deletion that checks dependencies first.
- Measure completion time, idle cost and abandonment, not resources created.
Feedback on this overview
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.