Skip to main content
A target is the cloud account and region formae works in. You need at least one before you can deploy resources or discover what is already there, so it is usually the first thing you set up. formae learns about a target when you declare it in a forma and apply it. A target is just another thing you describe in code, registered the moment you apply.
Before you start: the formae agent needs credentials for the account you are targeting, and you need a formae project (a PklProject with the schema dependencies). Starting fresh? Run formae project init, or follow Write your first forma.
1

Declare the target

A target lives in a forma, with a label and a provider config. Each cloud has its own config type, so pick yours:
The label is how you refer to the target from resources and on the CLI; config carries the provider settings. Targets are discoverable by default, which is what lets formae scan them for existing resources. Add discoverable = false to make a target deploy-only.
2

Apply it

formae shows the plan and asks you to confirm:
  formae apply · reconcile                                                                        target.pkl
────────────────────────────────────────────────────────────────────────────────────────────────────────────
  + 1 create

  ▌ Targets
  Operation ▲   Label
  + create      prod-us-west-2

────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ↑↓: select  space: expand  →←: column  s: sort  y: confirm  q: abort This operation will create 1
target(s).  Do you want to continue? (y/N)  ?: help
On confirmation it registers the target. No cloud resources are created: a target is a destination, not infrastructure. Because it is discoverable, formae also starts scanning the account for resources you can later bring under management.
3

Verify

Your new target appears in the list:
  formae inventory
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
                ╭───────────╮
  1 Resources    2 Targets    3 Stacks    4 Policies 
────────────────╯           ╰───────────────────────────────────────────────────────────────────────────────────────────

Label ▲                   Namespace              Discoverable    Config                                         
────────────────────────────────────────────────────────────────────────────────────────────────────────────────
prod-us-west-2            AWS                    yes             Region: us-west-2, Type: AWS                   

Showing 1 of 1 targets
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  /: query
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ↑↓/j/k: navigate  enter: detail  /: search  s: sort  r: refresh  1-4: tab  q: quit                           ?: help
Filter if you have many:

See also