One target or many
If a forma defines exactly one target, every resource in it belongs to that target automatically. You don’t set a target on each resource:Dynamic target config
Like a resource, a target’s config fields don’t have to be hardcoded. They can be driven by a property, for example a region you set on the command line:Discovery
Discovery scans your targets for resources formae doesn’t manage yet. Thediscoverable field controls whether a target is scanned; targets are
discoverable by default. Set discoverable = false on any target you want
excluded:
Applying a target-only forma (just targets, no resources) with
--mode reconcile
is safe. Reconcile only affects managed resources within a stack, and a
target-only forma has no stack, so there is nothing to remove.Unreachable targets
If the agent cannot reach a target for a sustained period, formae eventually cleans up that target’s discovered (unmanaged) resources from inventory so they don’t linger as stale entries. This is an inventory cleanup only: formae never deletes anything in the cloud, never touches resources under formae management, and never acts on a target with intermittent connectivity. Re-applying the target brings its inventory back. By default a target is cleaned up after it has been continuously unreachable for 24 hours. Set thereap field to change that window:
Replacing a target
Most target config changes update the target in place. Some config is immutable, though: changing it (switching region, changing a connection endpoint) triggers a target replace. formae deletes the target and every managed resource on it, then recreates them against the new config. Whether a resource survives that automatically depends on the resource:- Portable resources can be recreated on the new target.
- Non-portable resources cannot. An EC2 instance, for example, may use a region-bound AMI that doesn’t exist in the new region.
formae apply --simulate first: it shows which config fields changed and
whether each change updates in place or forces a replace.
Which config fields update in place versus force a replace is decided by the
plugin, not by you. As a user, it’s enough to know that some target config updates
in place and some forces a replace, and that
--simulate tells you which. Plugin
authors: see Plugin development.Deleting a target
Destroy a target-only forma (just targets, no resources) to remove the declared targets:--yes, a
destroy that would cascade is aborted unless you also pass
--on-dependents=cascade. Run interactively (without --yes) and formae shows
what will be cascaded and asks you to confirm.
Deleting a target removes its unmanaged resources from formae’s inventory, but
never from your cloud. formae only destroys resources it manages, so discovered
resources you never brought under management stay exactly where they are; formae
simply stops tracking them once their target is gone.
Targets during a full destroy
When you destroy a forma that has both targets and resources, formae keeps plain targets (a cloud region target, say), because they exist independently of the resources. Only a target whose config depends on a resource being destroyed, through a resolvable reference, is deleted automatically. To remove a plain target, destroy it separately with its own target-only forma.Sharing targets
Keep shared targets in one file and import them wherever you need them, so target config stays consistent across your formae. This is how our own infrastructure is organised:See also
- Resolvable: resolving target config from another resource.
- Discovery: how targets enable discovery.
- Stack: how resources are grouped for lifecycle.
- Architecture: one agent per target.

