basic_infrastructure.pkl, which
provisions a VPC, an internet gateway, subnets, routing, and security groups.
Set the scene
Apply the foundation so formae is managing it:Change something outside formae
Now make a change the way a teammate in a hurry would: in the AWS console, open the internet gateway that the foundation created and add a tag,Owner = platform-team.
Leave everything else alone.

Adding a tag to the internet gateway directly in the AWS console, outside formae.
formae detects the drift
The agent synchronizes with your cloud on an interval, reading the resources it manages and noticing anything that changed underneath it. Within a sync cycle it sees the new tag on the gateway.- CLI
- AI assistants
Reconcile the foundation as you normally would. formae reads the live state
first, sees that the stack changed since the last reconcile, and stops rather
than overwriting the change blindly:Instead of applying, formae opens an interactive screen listing every resource
that drifted and lets you decide what to do, right here:formae will not clobber the change. From this screen you choose: press
formae apply reconcile rejected
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Your infrastructure changed outside formae since the last reconcile.
Keep a change: extract the resource, fold it into your code, then re-apply.
Press r to discard all out-of-band changes and re-apply your code with —force.
Stack: lifeline (1 change)
──────────────────────────────────────────────────────────
▸ [x] update lifeline-igw (AWS::EC2::InternetGateway)
1 selected
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
e: extract selected r: revert all (—force) q: abort ?: help
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Your infrastructure changed outside formae since the last reconcile.
Keep a change: extract the resource, fold it into your code, then re-apply.
Press r to discard all out-of-band changes and re-apply your code with —force.
Stack: lifeline (1 change)
──────────────────────────────────────────────────────────
▸ [x] update lifeline-igw (AWS::EC2::InternetGateway)
1 selected
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
e: extract selected r: revert all (—force) q: abort ?: help
e to
extract the selected resource and keep the change, or r to revert all
out-of-band changes. You now decide: absorb the change or discard it.Absorb the change into your code
The tag is worth keeping, so make your code describe it. This is the path formae offers on the rejection screen: extract the live resource, fold the change into your forma, and re-apply.- CLI
- AI assistants
1
Extract the drifted resource
On the rejection screen, with Press enter to confirm. formae writes the file and reminds you that it holds
only the selected resource, so you fold the values into your own forma
rather than applying the file directly:
lifeline-igw selected, press e. formae
asks where to write the resource and extracts it live, tag and all: formae apply reconcile rejected
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Extracting 1 resource as code:
lifeline-igw (AWS::EC2::InternetGateway)
Extract to: ./extracted-drift.pkl█
Don’t apply this file directly. It holds only the selected resource(s), so
reconciling it would delete every other resource in the stack.
Copy the values you want to keep into your forma, then re-apply with —force:
formae apply —mode reconcile —force basic_infrastructure.pkl
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Extracting 1 resource as code:
lifeline-igw (AWS::EC2::InternetGateway)
Extract to: ./extracted-drift.pkl█
Don’t apply this file directly. It holds only the selected resource(s), so
reconciling it would delete every other resource in the stack.
Copy the values you want to keep into your forma, then re-apply with —force:
formae apply —mode reconcile —force basic_infrastructure.pkl
Extracted 1 resource(s) to ./extracted-drift.pkl
Fold the values you want to keep into your forma, then re-apply with —force:
formae apply —mode reconcile —force basic_infrastructure.pkl
Fold the values you want to keep into your forma, then re-apply with —force:
formae apply —mode reconcile —force basic_infrastructure.pkl
2
Fold the change into your forma
Copy the tag into the gateway’s definition in your own code. In the Lifeline
example the gateway lives in
network_resources.pkl:3
Re-apply, and the drift is gone
Reconcile again with The tag is now part of your committed infrastructure, not drift. Your code
and your cloud describe the same thing again.
--force. Your code now matches reality, so this
re-applies your forma (tag included) and clears the drift flag on the stack:Or discard the change
If the change was a mistake or a temporary hack, do the opposite from the same rejection screen: pressr to revert all out-of-band changes. formae shows exactly
what it will undo, down to the field, and asks you to confirm:
formae apply reconcile rejected
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
This will revert ALL out-of-band changes by re-applying with —force:
revert lifeline-igw (AWS::EC2::InternetGateway) Tags
Are you sure? This cannot be undone. (y/N)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
This will revert ALL out-of-band changes by re-applying with —force:
revert lifeline-igw (AWS::EC2::InternetGateway) Tags
Are you sure? This cannot be undone. (y/N)
y and formae re-applies your unchanged code with --force, removing
the tag and returning the gateway to exactly what your code describes. You can also
run formae apply --mode reconcile --force basic_infrastructure.pkl directly.
See also
- Incidents and recovery: absorb or discard a change you made yourself with a patch during an incident.
- Synchronization: how the agent reads live state and detects out-of-band changes.
- Apply modes: reconcile versus patch, and why a soft reconcile stops on drift.

