Fix a live incident with a patch
Patch mode is built for firefighting. It only creates or updates the resources you name and never destroys anything, so the blast radius is exactly the resource or two you are touching. See Apply modes for the full contrast with reconcile.- CLI
- AI assistants
1
Write a focused forma
Include only the resources you are adding or fixing. The stack and target
must already exist:
2
Apply the fix
formae shows the plan and asks you to confirm, then streams the run in a
live view:Add
formae apply · patch hotfix.pkl
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+ 1 create
▌ Resources
Operation ▲ Label Type
+ create incident-logs AWS::S3::Bucket
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
↑↓: select space: expand →←: column s: sort y: confirm q: abort This operation will create 1 resource(s). Do
you want to continue? (y/N) ?: help
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+ 1 create
▌ Resources
Operation ▲ Label Type
+ create incident-logs AWS::S3::Bucket
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
↑↓: select space: expand →←: column s: sort y: confirm q: abort This operation will create 1 resource(s). Do
you want to continue? (y/N) ?: help
--yes to skip the confirmation prompt when you are certain and need
speed.Settle up after the fix
A patch leaves your codebase describing something slightly different from reality: it created drift. Once the fire is out, you settle up in one of two ways, depending on whether the change was worth keeping. Until you do, the next soft reconcile on that stack detects the drift and fails, which is the reminder that code and reality disagree.Absorb the change, if you want to keep it
The bucket you patched in is worth keeping, so make your code describe it. Extract the live resource into a forma file, fold it into your formae project, and reconcile. Now the stack matches your code again, and the resource is a first-class part of it.- CLI
- AI assistants
1
Extract the patched resource
Pull the resource formae created during the incident into a forma file:
Extracted 1 resource to ./incident-logs.pkl
incident-logs (AWS::S3::Bucket) on stack production
incident-logs (AWS::S3::Bucket) on stack production
2
Fold it into your formae project and reconcile
Add the extracted resource to your formae project, then reconcile so code
and infrastructure agree:The reconcile is now a no-op for the bucket, because your code already
describes it. The drift is gone.
╭─ formae apply ──────────────────────────────────────────────────────────────╮
│ No changes needed │
│ │
│ The specified forma resources are up to date. │
╰────────────────────────────────────────────────────────────────────────────╯
│ No changes needed │
│ │
│ The specified forma resources are up to date. │
╰────────────────────────────────────────────────────────────────────────────╯
Discard the change, if it was a throwaway
If the patch was a temporary workaround you do not want to keep, do the opposite: reconcile your unchanged code back over it. Reconcile removes anything not in the forma, so the patched resource goes away and the stack returns to exactly what your code describes.- CLI
- AI assistants
formae apply · reconcile main.pkl
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
- 1 delete
▌ Resources
Operation ▲ Label Type
- delete incident-logs AWS::S3::Bucket
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
↑↓: select space: expand →←: column s: sort y: confirm q: abort This operation will delete 1 resource(s). Do
you want to continue? (y/N) ?: help
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
- 1 delete
▌ Resources
Operation ▲ Label Type
- delete incident-logs AWS::S3::Bucket
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
↑↓: select space: expand →←: column s: sort y: confirm q: abort This operation will delete 1 resource(s). Do
you want to continue? (y/N) ?: help
See also
- Apply modes: patch versus reconcile, and how drift is detected and resolved.
- Synchronization: how formae detects the out-of-band changes a patch introduces.
- Everyday changes: the routine inspect, change, and tear-down operations.
- Troubleshoot a failed command: read the detailed status layout to see which resource broke and why.
- Cancel a running command: stop an in-progress command without leaving orphaned resources.
- CLI reference: full flags for
apply,cancel,status,inventory, andextract.

