A policy is a configurable behavior you attach to a stack. Where a forma declares what resources should exist, a policy declares how formae should manage the stack’s lifecycle over time, without you having to run another apply.
formae has two built-in policy types:
- TTL policy: destroys a stack and its resources after a set duration.
- Auto-reconcile policy: re-applies the stack’s declared state at a fixed interval, undoing out-of-band and incremental changes.
Inline vs. reusable policies
You can define a policy two ways.
Inline policies live directly inside a stack definition. They belong to that stack alone and are deleted along with it.
Reusable policies are standalone objects, defined once and referenced from any number of stacks with .res. Changes to the policy propagate to every stack that references it.
Reach for a reusable policy as soon as you find yourself copying the same ttl or interval value into more than one stack. A single source of truth means one edit updates every stack that uses it.
Removing a policy
In reconcile mode, the applied forma is the source of truth for a stack’s policies, the same way it is for the stack’s resources:
- Inline policy: re-apply the stack without the policy in its
policies listing, and the policy is deleted.
- Reusable policy: re-apply the stack without the
.res reference, and the policy is detached from that stack. The standalone policy object itself lives on, attached to whatever other stacks still reference it, until it is destroyed.
This also means an inline policy added outside the forma (for example through an operator tool) does not survive the next reconcile of a stack the forma declares: declare it in the forma to keep it. Patch mode never touches policies you don’t mention.
Querying policies
Lists reusable policies only, since inline policies have no independent identity outside their stack. To see which policy, inline or reusable, is attached to a given stack, check the stack itself:
See also