Define the Minimal Service and Its Cost Boundary
A capstone is a release a reviewer can reject. You build one small ledger service inside one compartment subtree, split it across three roots, promote one immutable image, prove it with positive and denied cases, break one permission on purpose, and hand over six deliverables. The system is deliberately dull; the evidence is the work.
| ID | Deliverable | Accepted when |
|---|---|---|
| D1 | Scope and cost record | one service, one region, a USD 10 ceiling for 72 hours and its stop rules |
| D2 | Ownership matrix | every object has one root, one state prefix and one credential scope |
| D3 | Three applied roots | bootstrap, data and service plan and apply with no console edits |
| D4 | Promotion record | plan digest and image digest approved together, applied once |
| D5 | Acceptance matrix | five positive and five denied cases, each with an evidence source |
| D6 | Recovery and cleanup report | one controlled failure recovered, three no-change plans, a cost reconciliation |
The service is a single-writer ledger behind five routes. A caller writes one record under a key, reads it back, and asks whether the process is alive, whether it can reach its data, and which build is running. Nothing is public except the listener, and every write lands under one prefix in one bucket.
| Route | Method | Data call | What it proves |
|---|---|---|---|
/notes | POST | one object write | the write path and the prefix |
/notes/{key} | GET | one object read | the read path and the missing-key branch |
/health | GET | none | the process is running |
/ready | GET | one sentinel read | principal, bucket and network in one answer |
/version | GET | none | the running image is the promoted digest |
Caller admission is network-based in version one. The listener admits the reviewer's address through an NSG rule and authenticates nobody, which is a deliberate exclusion in D1 rather than a claim about identity. Every denial in this capstone is about the network path, the data plane or the front end, not about who the client is.
Authorization has two layers and only one of them is yours. The load balancer and the network security group decide who may reach the process, and the instance principal decides whether the process may touch the bucket. A caller that passes the first layer and fails the second is the proof that both exist.
Choose the exposure path before the first credential. The reference path is a private instance behind a public load balancer that terminates TLS with an imported certificate. The accepted substitute is a reserved public IP with an NSG allowlist and no balancer, which is cheaper and still proves the principal boundary, but it proves host TLS or an allowlist rather than listener TLS.
| Path | What Terraform records | What the lab still proves | What it cannot prove |
|---|---|---|---|
| Private instance and public balancer | listener certificate, backend set, backend address | TLS segment, health contract, backend state | the certificate an instance would present itself |
| Public instance and NSG allowlist | reserved address, NSG ingress from one CIDR | principal boundary, readiness, version | listener TLS and balancer health states |
The cost ceiling is a number with stop rules, not a hope. Write USD 10 for a 72-hour window into D1, then bound every driver that could reach it. No price on this page is a quote; the estimate comes from your tenancy's cost estimator, and the ceiling is compared against the cost report for the compartment subtree.
| Driver | Bound written into D1 | What breaks the ceiling |
|---|---|---|
| Compute | one instance, one OCPU, the smallest legal memory, 72 hours | a second member, or a shape chosen for a benchmark |
| Balancer | one flexible balancer at the minimum bandwidth, one listener | a second listener, or bandwidth sized to a peak nobody measured |
| Storage | one bucket, 50 GB boot volume, previous versions expire in 7 days | a version per request and no lifecycle rule |
| Registry | one repository, five digests retained | an image per commit and no cleanup |
| Logs | one log group, 30-day retention, no request bodies | debug lines that print record contents |
| Egress | no NAT gateway, no service connector archive | sending logs to a second bucket in another region |
| Keys | none in version one | creating a vault for a key nothing uses |
A budget observes; it does not stop anything. OCI evaluates budget alerts every 24 hours, so a runaway loop can spend the ceiling between two evaluations. The stop rules are the schedule, the single-instance bound and the quota; the budget is the signal that tells you the rules were not followed.
| Prerequisite | How to verify | If it fails |
|---|---|---|
| Region subscribed, one availability domain chosen | the region appears in the subscription list | stop, or change region before writing D1 |
| Compute quota for the shape family | the limit page shows headroom for one instance | request an increase, or pick another shape |
| Balancer bandwidth headroom | the limit page covers the minimum shape | use the no-balancer path |
| An image that boots the shape | the image lists the shape as compatible | stop, the launch is not a Terraform problem |
| Object Storage namespace and a customer secret key | a read-only bucket listing succeeds | stop, the backend has no home |
| A certificate for the listener | the certificate is visible to the balancer | run the allowlist path, or record TLS as blocked |
| Budget permission in the root compartment | a read-only budget listing succeeds | ask finance, budgets are not a child-compartment object |
| A named reviewer and approver | both names in D1 | the capstone has no gate |
Scope is two lists, and the exclusion list is the useful one. "The service" cannot fail a test; "one listener, one instance, one bucket, one image" can.
| Boundary | Included | Excluded |
|---|---|---|
| Traffic | one public listener, platform TLS, one backend | WAF, DNS zone, custom domain, caller authentication, second region |
| Compute | one instance, one shape, one fault domain | autoscaling, a second member, a second AD |
| Data | one bucket, versioning, 7-day previous-version expiry | retention lock, replication, pre-authenticated requests |
| Operations | one log group, one log, three alarms, one budget | on-call rotation, tracing, log archive |
Figure 1 is the decision the scope record makes before a credential exists.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
S["Scope record
one region, one service, one bucket
USD 10 for 72 hours"] --> P{"Exposure path
balancer or allowlist?"}
P -- "balancer" --> L["Private instance
public listener, imported certificate"]
P -- "allowlist" --> R["Public instance
reserved address, NSG CIDR"]
L --> Q{"Prerequisites met
region, quota, limit, image,
namespace, certificate?"}
R --> Q
Q -- "no" --> X1["Stop
no compartment created"]
Q -- "yes" --> C["Ceiling and stop rules
written into D1"]
C --> V{"Reviewer accepts D1?"}
V -- "no" --> X1
V -- "yes" --> T["Three roots
bootstrap, data, service"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class S,T primary;
class L,R,C secondary;
class P,Q,V warn;
class X1 danger;
Figure 2 draws the same scope as four planes, because the owners of the image, the compartments, the listener and the bucket are not the same team.
The four planes disagree about time. The image is a version that changes on a build, the compartments outlive every workload in them, the listener exists for the length of the release, and the bucket is the only surface that must survive a teardown decision. A record that stores one OCID cannot say which plane moved.
Partition Identity, State, Artifacts and Data Ownership
Three roots exist because three things fail differently. A workload destroy must not remove the state that describes it, a data restore must not require a service release, and an artifact rollback must not depend on the stack that consumes it. Split by lifetime and by verb, not by folder convenience.
Compartments are the cost and policy boundary, not the network boundary. A compartment scopes IAM, quota, budget and cost reporting, while reachability is decided by subnets, route tables and NSGs. Two resources in one compartment can still be unreachable, and two in different compartments can still talk.
| Compartment | Holds | Policy attachment | Why not merged |
|---|---|---|---|
| Tenancy root | compartments, dynamic group, budget, bootstrap policy | root, by a named administrator | a workload grant in the root is a tenancy grant |
cap-platform | state bucket and registry | bootstrap root | it must outlive the workload it describes |
cap-service | VCN, subnets, NSG, instance, listener, logs, alarms | bootstrap root, scoped by name | it is destroyed on the release schedule |
cap-data | the ledger bucket and its lifecycle | bootstrap root, scoped by name | it has its own restore and delete decision |
Identity is partitioned by verb, and six identities is enough. If the identity that plans can also apply, the approval is decorative; if the identity that builds can also deploy, the digest is a suggestion.
| Identity | Used by | May do | Must not do |
|---|---|---|---|
| Break-glass administrator | a named human, console only | create compartments, the dynamic group and root policy | run the daily applies |
| Plan identity | CI plan job | read all three roots, write a plan artifact | change a resource |
| Apply identity | CI apply job | apply one saved plan, use the state bucket | edit policy or the backend |
| Build identity | image build job | push to one repository | deploy, or read the bucket |
| Runtime principal | the instance, by dynamic group | write and read one prefix, post one metric | touch state, registry or policy |
| Verifier | the reviewer's session | read-only describe, call the listener | write to the bucket directly, or change a policy |
The runtime grant names the principal, the verb and the compartment. A dynamic group rule matches the instance by compartment, and a policy statement grants object use in the data compartment. Neither half is authorization on its own, and a rule change can take about an hour to propagate while a policy edit usually lands in minutes.
State has one home and three prefixes. One bucket in the platform compartment, versioning enabled, one prefix per root. The bucket is the first object created and the last object destroyed, and it never lives under the root that owns the workload it records.
OCI Object Storage gives you state, not a lock. The S3-compatible endpoint stores the object reliably, but there is no DynamoDB equivalent to hold a lock, so a second writer is prevented by a CI concurrency group and a zero-writer rule rather than by the backend. The substitute is a Resource Manager stack per root, where the service runs one job at a time and owns the state itself.
| Backend choice | What it gives | What it costs | When to choose it |
|---|---|---|---|
| Object Storage, S3-compatible endpoint | versioned state, one prefix per root | no lock, so the writer rule is process | the reviewer accepts a documented single-writer rule |
| Resource Manager stack per root | service-managed state, one job at a time, job history | less local tooling, plan digests live in the job | the reviewer requires a real lock |
Whichever backend you choose, write it into D2. The recovery path differs: one restores an object version, the other re-runs a job against a recorded state serial. A record that says only "remote state" cannot be executed by the next person.
Backend recovery is a read, not a rebuild. Copy an earlier object version into a scratch prefix, point a scratch workspace at it, and run a plan that must show the estate as it was. The workload keeps serving throughout, because the bucket sits in a different root and a different compartment from the service it describes.
The guards are a review gate, not a permanent state. A prevent_destroy lifecycle on the state bucket and on the registry repository stops a mistaken apply, and removing it is the last reviewed change before teardown. A guard that nobody may remove becomes a resource nobody may clean up.
The registry is durable because it is outside the workload. If the repository lived in the service root, destroying the service would delete the rollback targets, and a bad release would be unrollable at the worst moment. Keep the repository in the platform compartment with a cleanup step that keeps five digests.
Data ownership includes the delete decision. The bucket enables versioning from the first apply, and a lifecycle rule expires previous versions after seven days. Retention lock is deliberately excluded because it would refuse the delete that ends the lab, and that exclusion belongs in D1 rather than in a comment.
A module contract is shared; a backend is not. All three roots accept the same five inputs, return names and OCIDs rather than credentials, and read no other root's state. Hand-offs are a tfvars file recorded in the promotion record, so a module change cannot move a boundary.
| Object | Root | State prefix | Credential scope | Runtime owner |
|---|---|---|---|---|
| Compartments, dynamic group, policy | Bootstrap | bootstrap/platform | tenancy administration | platform |
| State bucket and its versions | Bootstrap | bootstrap/platform | object use on one bucket | platform |
| Registry repository and images | Bootstrap | bootstrap/platform | repository push and pull | build |
| Budget and its alert rule | Bootstrap | bootstrap/platform | usage-budget management in the root | finance |
| Ledger bucket and lifecycle | Data | data/prod | bucket and object use in one compartment | data |
| VCN, NSG, instance, listener, alarms | Service | service/prod | network, compute, load balancer, monitoring | service |
Figure 3 assigns one owner to each surface and turns every cross-root dependency into a named artifact.
Read the map in both directions. Every box has exactly one root, and every arrow is a variable or an artifact. An arrow that carries a credential means the boundary leaked even while the plans stay clean.
Figure 4 follows the mechanics, including the branches that produce a valid plan with the wrong owner.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
B["Bootstrap root
compartments, state bucket,
registry, budget, policy"] --> K["One prefix per root
bootstrap, data, service"]
K --> D["Apply data root
bucket, versioning, lifecycle"]
D --> O["Outputs
bucket name and namespace"]
O --> S["Plan service root
VCN, NSG, instance, listener, alarms"]
S --> A{"Plan touches an object
owned by another root?"}
A -- "yes" --> X1["Stop
ownership leak, move the object"]
A -- "no" --> W{"Second writer
on this prefix?"}
W -- "yes" --> X2["Zero-writer window first
then re-plan"]
W -- "no" --> AP["Apply the saved plan"]
AP --> OK["Three roots applied
one image digest"]
B -.->|"destroyed with the workload"| X3["State lost with
the thing it described"]
D -.->|"destroyed before the service"| X4["Readiness returns 404
the bucket is gone"]
S -.->|"holds the registry"| X5["Rollback target deleted
by the release that needed it"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class B,AP primary;
class K,D,O,S secondary;
class A,W warn;
class OK ok;
class X1,X2,X3,X4,X5 danger;
The dashed branches are the ones a valid plan hides. Moving the state bucket into the workload root, destroying data before the service, and keeping the registry inside the release all produce clean plans and unrecoverable states.
| Symptom | Collapsed boundary | First evidence |
|---|---|---|
| Init fails after the workload is gone | the state bucket lived in the service root | the backend error at init |
| Rollback target missing after teardown | the repository lived in the service root | an empty repository listing |
| A plan rewrites a bucket the service did not create | both roots declare the bucket | the plan address list |
| Apply denied only on some days | one credential shared by three jobs | the caller named in the error |
Promote a Reviewed Plan and Immutable Application Artifact
Promotion is two digests and one signature. The image digest is what ran the tests; the plan digest is what describes the infrastructure change; the signature covers both at the same moment. A plan approved against one digest and applied with another is an unreviewed deployment with a reviewed filename.
| Field | What it records | Why it matters |
|---|---|---|
| Commit and tree | the configuration that was reviewed | a moved branch invalidates the plan |
| Toolchain | Terraform 1.17.1 and oracle/oci 9.12.1 | a different producer makes a different plan |
| Lock file | committed provider selections and hashes | a silent upgrade changes behaviour |
| Plan digest | the hash of the saved plan file | the applied bytes match the reviewed bytes |
| Image digest | the immutable artifact that passed acceptance | the tested code is the promoted code |
| Compartment OCIDs | platform, service and data | a stale value plans against the wrong estate |
| Data contract | bucket name, namespace and prefix | a stale contract proves the wrong data plane |
| Approver and expiry | a named human and a deadline | approval is for a change, not a season |
Pin the producer, not just the product. Every root constrains Terraform to 1.17.1 and the provider to 9.12.1, commits its lock file, and sets the region in the provider block rather than inheriting an exported variable. The CI runner image is pinned by digest too, because a plan from a different Terraform build is a different plan even when the source is identical.
The artifact is immutable before Terraform sees it. A registry tag can be pushed over, so the tag is a convenience and the digest is the identity. The instance carries the digest in its metadata, where /version can compare it with the promotion record; a digest is not a credential, so metadata is the right place for it and the wrong place for a key.
| Order | Command shape | What it produces or proves |
|---|---|---|
| 1 | terraform init with the root's backend configuration | the root bound to its own prefix |
| 2 | terraform plan -out=tfplan | the reviewed change, saved |
| 3 | terraform show -json tfplan | the machine-readable record |
| 4 | a SHA-256 of the plan file | the digest the approver signs |
| 5 | terraform apply tfplan | exactly the reviewed bytes |
| 6 | terraform plan -detailed-exitcode | zero means no drift, two means a diff |
The order across roots is part of the design. Apply bootstrap, then data, then service; destroy service, then data, then bootstrap. The data root consumes nothing from the service, and the service consumes the bucket name and the compartment OCIDs, so reversing either direction plans against a name that does not exist yet.
Plan and apply are separate jobs with separate identities. The plan file is encrypted, readable by the named reviewer and the apply identity, and destroyed after the apply. The apply job re-checks the digest and the approval expiry before it configures the provider, so a stale approval fails before it can change anything.
There is no schema migration in version one, and that is a decision. The record shape lives in the application, so a new field is an image release with its own digest. Changing the key layout is a data migration with a copy step, its own owner and its own date, because the application reads whatever prefix the plan declares.
A saved plan is a secret. It can contain variable values and data source results in clear text, so it is stored as a private object with a short expiry. Attaching a plan file to a ticket publishes everything the plan read, including the state bucket path.
The promotion record is written before the apply and completed after it. The approver, the expiry and both digests go in first; the observed listener address and the applied job identity go in second. A record reconstructed from memory at the end of the day is a story with a hash in it.
Figure 5 contrasts the promoted path with the shortcuts that pass a review without earning it.
Rollback is a digest and a variable. The repository kept the previous image and the plan was saved, so rollback is a new plan that changes one input to the previous digest. It is still a reviewed change, simply one with a known-good destination and no rebuild.
Prove the Service Through Positive and Negative Cases
Apply success is the beginning of the evidence. The matrix below runs against the deployed listener with the deployed identities, and a case that records a status without naming the layer that produced it is an anecdote.
| ID | Case | Action | Expected result | Evidence source |
|---|---|---|---|---|
| P1 | Authorized write | POST one record as the verifier | 201 and one object under the prefix | response and bucket listing |
| P2 | Authorized read | GET the same key | 200 with the stored bytes | response body and checksum |
| P3 | Liveness | GET the health route | 200, no data call | application log line |
| P4 | Readiness | GET the ready route | 200 after one sentinel read | application log and latency |
| P5 | Version | GET the version route | the digest the record approved | response body |
| N1 | No listener on the port | connect to the public address on an unused port | refused, no backend involved | connection result and listener list |
| N2 | Runtime grant removed | delete the object grant, then call ready | 503 and a denied call in audit | application log and audit event |
| N3 | Probe source removed | remove the NSG rule that admits the balancer on the app port | unhealthy backend while the instance runs | balancer metric and backend state |
| N4 | Certificate mismatch | use a certificate that does not cover the name | handshake failure with a healthy backend | client error and backend health |
| N5 | Stale digest | write the previous digest into metadata, then restart | version route disagrees with the record | response body and promotion record |
The layer that answers names the control. A 503 from readiness is a data-plane grant, an unhealthy backend is a network rule, a handshake failure is the listener certificate, and a version mismatch is the promotion check. Five results, four owners.
| Result | Decided by | Owner | First place to look |
|---|---|---|---|
| 503 on ready | the runtime principal's grant | data | the policy statement and the group rule |
| Unhealthy backend | the NSG rule for the probe | service | the rule's source and port |
| Handshake failure | the listener certificate | service | the certificate's names and expiry |
| Version mismatch | the metadata the release wrote | apply | the promotion record's digest |
| Refused connection | the listener configuration | service | the listener list and the rule set |
Readiness is a data-plane claim, so it has to touch data. The health route proves the process is up; the ready route performs one read against a sentinel object. Without that read, a running process and a revoked grant produce the same green check. The sentinel is the one object Terraform may legitimately declare, because it must exist before the first pipeline run.
Telemetry is owned before the first request. The service root creates the log group, the log with 30-day retention, and three alarms: an availability alarm on the balancer's unhealthy backend count, a correctness alarm on the application's rejected-request metric, and an absence alarm on that metric so a stopped publisher is a page. Set the absence window deliberately, because the default of two hours is longer than this service's objective, and confirm the notification subscription rather than assuming it.
The two probes answer different questions, and the negative cases keep them apart. Removing the object grant breaks readiness while liveness stays green; removing the probe rule breaks the backend while the instance stays up. One action per case, or the evidence cannot say which control moved.
Run the matrix twice. The first run proves behaviour; the second, after a no-change plan in all three roots, proves that nothing moved underneath the passing result. A case that passes only on the first run is a timing dependency wearing a green tick.
Figure 6 places the evidence beside the request path, and Figure 7 turns the matrix into a flow with the branches that produce nothing a reviewer can use.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
R["Release candidate
plan digest and image digest"] --> P["P1 to P5
write, read, health, ready, version"]
P --> D{"Every positive case
left an artifact?"}
D -- "no" --> Y1["An anecdote
re-run with capture enabled"]
D -- "yes" --> N["N1 to N5
with the refusal recorded"]
N --> L{"Does the result name
the layer and the control?"}
L -- "no" --> Y2["A status code without an owner
not evidence"]
L -- "yes" --> E["Evidence bundle
log, metric and audit joined by request id"]
E --> Z["Second pass after
three no-change plans"]
Z --> OK["Acceptance recorded
and signed"]
Y1 -.-> R
Y2 -.-> N
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class R,OK primary;
class P,N,E,Z secondary;
class D,L warn;
class Y1,Y2 danger;
Recover a Controlled Failure and Submit the Evidence
The controlled failure is chosen, not suffered. Remove the runtime grant, watch readiness fail while liveness stays green, restore the statement, and prove the service returns without a rebuild. That single action tests the data-plane boundary, the readiness contract and the recovery owner at once.
A failure that recovers from a saved plan is the strongest result. The instance is never replaced, the image digest never changes and the bucket keeps its versions, so the only thing that moved is one policy statement. Record the before and after plan identifiers to show that nothing else did.
The recovery owner is named before the test. Restore rights over the policy belong to the bootstrap administrator, not to the pipeline, because the pipeline that can remove a grant should not be the only thing that can put it back. That separation is the reason the bootstrap root exists.
Three no-change plans are the closing proof. One per root, run after the recovery, each returning the no-change exit code. A clean plan in the service root and a diff in another root means the recovery touched an object it did not own.
The data recovery decision is written, not implied. The ledger objects are disposable in this lab, so the decision is "restore by version, claim no disaster recovery", and D6 says so in one sentence. A production ledger would need a retention lock or a second copy and a different owner, which is a different capstone.
Cleanup is an order, and the first step is traffic. Drain or remove the backend, destroy the service root, empty the bucket including versions and delete markers, destroy the data root, remove the guards in a reviewed commit, then destroy the bootstrap root. The state bucket cannot destroy itself while it holds the bootstrap state, so D2 records whether bootstrap runs on local state or the bucket is removed by hand at the end.
The leftovers are the objects that outlive their owner. A preserved boot volume, a reserved public IP from the alternate path, a retained image digest, a pre-authenticated request, uncommitted multipart parts and a compartment in its 90-day deletion window all keep existing after a successful destroy. The inventory is a listing per compartment, not a reading of the plan.
Cost reconciliation is a report read, not an alert. Compare the compartment subtree's cost report for the window against the ceiling in D1, and record the three largest lines. A budget alert that never fired proves the period, not the spend.
Recover a Controlled Failure and Submit the Evidence
Status: design-only. No OCI tenancy, credential or billable resource was used, and none of these steps were executed. Every identifier is a placeholder you supply: the tenancy, the three compartments, the certificate and the reviewer. Versions: Terraform 1.17.1, oracle/oci 9.12.1, checked 6 November 2026.
Prerequisites. A sandbox tenancy with one subscribed region, quota for one instance of the chosen shape, balance headroom for one flexible balancer, an image that lists the shape as compatible, an Object Storage namespace, a customer secret key for the backend, a certificate visible to the balancer, and a named reviewer. Without the certificate, run the allowlist path and record the two balancer cases as blocked rather than passed.
| Object | Lab value |
|---|---|
| Compartments | cap-platform with cap-service and cap-data as children |
| Instance | one OCPU, smallest legal memory, private subnet, no public address |
| Listener | public, one HTTPS listener, one backend set with an HTTP check |
| Probe | readiness path that reads one sentinel object |
| Bucket | one bucket, versioning on, prefix ledger/v1/ |
| Lifecycle | expire previous versions after 7 days |
| Alarms | unhealthy backends, rejected requests, metric absence |
| Budget | root-owned, scoped to the platform subtree, 50 and 80 percent actual plus 100 percent forecast |
- Baseline. Read the empty plan in all three roots and record the cost report line for the subtree. A non-empty baseline makes every later diff ambiguous.
- Record the rollback target. Write the image digest, the plan digest, the three compartment OCIDs and the bucket name into D4 before changing anything.
- Apply in order. Bootstrap, then data, then service, each from a saved plan and with no console edits afterwards. A console edit during the lab invalidates every later plan.
- Write one record and read it back. Capture the response, the object listing and the checksum. A body that differs from the write is a data-plane finding, not a client bug.
- Call both probes. Health returns 200 without touching the bucket; readiness returns 200 only after the sentinel read appears in the log.
- Read the version route. Compare the digest with D4. A mismatch means the instance is running something the record never approved.
- Run the denied network case. Connect to the public address on a port with no listener and record the refusal, the missing log line and the listener list that explains it.
- Remove the runtime grant. Delete the object statement from the policy, wait for propagation, then call readiness. Expect 503 and a denied call in audit naming the principal.
- Confirm the split. Health still returns 200 while readiness fails, which is the proof that the process and its data path are separate claims.
- Restore the grant. Re-apply the bootstrap root from its saved plan, then call readiness and confirm recovery without a replacement. Record how long the recovery took.
- Break the probe path. Remove the NSG rule that admits the balancer on the application port and watch the backend go unhealthy while the instance stays up. Restore the rule and confirm the backend returns.
- Check the alarms. Confirm a notification for the unhealthy backend from step 11, and confirm the absence alarm stayed quiet while the publisher was alive. Record the delay between the state change and the message.
- Break the front end. Point the listener at a certificate that does not cover the name, confirm the handshake fails while the backend stays healthy, then restore the certificate.
- Recover, then close. Run the three no-change plans and require the no-change exit code in each. Then drain the backend, destroy the service root, empty and destroy the data root, remove the guards, destroy the bootstrap root, and list what remains.
| Check | Where it is read | Pass condition | What a failure means |
|---|---|---|---|
| No-change plans | three roots | no-change exit code in each | drift, or a recovery applied by hand |
| Readiness denial | application log and audit | 503 with a named principal | the grant was wider than the record claimed |
| Probe boundary | balancer metric | unhealthy backend, instance up | the rule removal did not reach the probe |
| Version identity | version route | the digest in D4 | the release ran an image nobody approved |
| Teardown | per-compartment listings | no volume, address, request or image without an owner | a guard or a reserved object survived |
| Cost | subtree cost report | at or below the ceiling, three lines named | a second driver was created silently |
Expected observation. A sequence rather than a duration: the empty baseline, the three applies, one write and read with matching bytes, both probes green, one refused connection, readiness failing while health stays green, recovery without a replacement, the unhealthy backend with a healthy instance, the alarm notification, the handshake failure, three no-change plans and a teardown inventory. Capture the plan identifiers, the request identifier and the audit timestamp so the sources can be joined afterwards.
Failure checks. A readiness failure that also breaks health points at the instance or the listener, not the grant. A backend that never becomes healthy after the rule is restored points at the NSG source rather than the application. A version mismatch with correct traffic points at the release metadata rather than the image. A bucket that will not delete points at versions, delete markers, multipart parts or a pre-authenticated request, in that order.
Cost dimensions. Instance hours for the whole window, balancer minimum bandwidth rather than measured traffic, storage for the boot volume and every retained object version, image storage per digest, and log ingestion for a 30-day retention. The lab is small; the retained versions and the idle balancer are the lines that surprise people.
Cleanup order. Remove the backend, destroy the service root, delete every object version and delete marker in the bucket, destroy the data root, remove the destroy guards in a reviewed commit, destroy the bootstrap root, then delete saved plans and the scratch state copy. Keep only the redacted evidence bundle. Confirm the compartments show a deletion window rather than disappearing.
Evidence to submit. D1 to D6 in one bundle: the scope and cost record, the ownership matrix, the three plan and apply identifiers, both digests and the signature, the ten-case matrix with its evidence sources, the recovery timeline, the three no-change plans and the teardown inventory. Redact the customer secret key, any state content and any object body; keep OCID suffixes, digests, timestamps and event names.
A missing denial is a result, not a failed lab. A principal that still reads after the statement was removed proves the policy is wider than the record claimed, and that finding is cheaper before an incident than after. Write it beside the statement that granted it.
Recovery has two clocks. The policy stops the next read once it propagates, while an application that cached a credential or an object keeps serving until its cache expires. Evidence that shows only the first clock is a permission test, not a recovery test.