Before you start: discovery has to have run on a discoverable target. If you
haven’t set one up yet, do Create a target
first. The examples below adopt AWS internet gateways; use the equivalent types
for your own resources.
- CLI
- AI assistants
1
Find the unmanaged resources
Discovery records the resources formae doesn’t manage yet. List what it
found in your inventory:The query matches resources by attribute, so add filters to home in on
exactly what you want. Here, only the internet gateways:You can filter by attributes like
formae inventory
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
╭─────────────╮
│ 1 Resources │ 2 Targets 3 Stacks 4 Policies
─╯ ╰────────────────────────────────────────────────────────────────────────────────────────────────────
Label ▲ Stack Type NativeID
────────────────────────────────────────────────────────────────────────────────────────────────────────────
formae-auto-recon-inline-1⚠ unmanaged AWS::EC2::InternetGateway igw-037caa5c87583128e
formae-auto-recon-standal…⚠ unmanaged AWS::EC2::InternetGateway igw-0555aa2884ab0d7a8
formae-lgtm-igw ⚠ unmanaged AWS::EC2::InternetGateway igw-0ec4e39eb6bf0a348
igw-00fda294a8aa7d0ce ⚠ unmanaged AWS::EC2::InternetGateway igw-00fda294a8aa7d0ce
igw-03ff9cdf7e484fcbe-2 ⚠ unmanaged AWS::EC2::InternetGateway igw-03ff9cdf7e484fcbe
igw-06c867a1939f44327 ⚠ unmanaged AWS::EC2::InternetGateway igw-06c867a1939f44327
igw-0e65d7a67d98849cf ⚠ unmanaged AWS::EC2::InternetGateway igw-0e65d7a67d98849cf
lifeline-1558-igw-2 ⚠ unmanaged AWS::EC2::InternetGateway igw-03c849fb5154f7715
lifeline-abc1-igw-1 ⚠ unmanaged AWS::EC2::InternetGateway igw-0b9e65ff163e1b5ff
Showing 9 of 9 resources (filtered)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
/ managed:false type:AWS::EC2::InternetGateway /: edit query
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
╭─────────────╮
│ 1 Resources │ 2 Targets 3 Stacks 4 Policies
─╯ ╰────────────────────────────────────────────────────────────────────────────────────────────────────
Label ▲ Stack Type NativeID
────────────────────────────────────────────────────────────────────────────────────────────────────────────
formae-auto-recon-inline-1⚠ unmanaged AWS::EC2::InternetGateway igw-037caa5c87583128e
formae-auto-recon-standal…⚠ unmanaged AWS::EC2::InternetGateway igw-0555aa2884ab0d7a8
formae-lgtm-igw ⚠ unmanaged AWS::EC2::InternetGateway igw-0ec4e39eb6bf0a348
igw-00fda294a8aa7d0ce ⚠ unmanaged AWS::EC2::InternetGateway igw-00fda294a8aa7d0ce
igw-03ff9cdf7e484fcbe-2 ⚠ unmanaged AWS::EC2::InternetGateway igw-03ff9cdf7e484fcbe
igw-06c867a1939f44327 ⚠ unmanaged AWS::EC2::InternetGateway igw-06c867a1939f44327
igw-0e65d7a67d98849cf ⚠ unmanaged AWS::EC2::InternetGateway igw-0e65d7a67d98849cf
lifeline-1558-igw-2 ⚠ unmanaged AWS::EC2::InternetGateway igw-03c849fb5154f7715
lifeline-abc1-igw-1 ⚠ unmanaged AWS::EC2::InternetGateway igw-0b9e65ff163e1b5ff
Showing 9 of 9 resources (filtered)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
/ managed:false type:AWS::EC2::InternetGateway /: edit query
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
type, label, and target, and use
* wildcards. See the CLI reference for
the full query syntax.2
Extract the ones you want
Pull the resources you want into a forma:This writes
Initialized new Pkl project at .
Initialized pkl project at ’.’
Extracted 9 resources to networking.pkl
formae-auto-recon-inline-1 (AWS::EC2::InternetGateway) on stack unmanaged</span><br/> <span style={{color:'rgb(129,209,219)'}}>formae-auto-recon-standalone-1</span> (<span style={{color:'rgb(170,170,170)'}}>AWS::EC2::InternetGateway</span>) on stack <span style={{color:'rgb(232,232,232)'}}>unmanaged
formae-lgtm-igw (AWS::EC2::InternetGateway) on stack unmanaged</span><br/> <span style={{color:'rgb(129,209,219)'}}>igw-00fda294a8aa7d0ce</span> (<span style={{color:'rgb(170,170,170)'}}>AWS::EC2::InternetGateway</span>) on stack <span style={{color:'rgb(232,232,232)'}}>unmanaged
igw-03ff9cdf7e484fcbe-2 (AWS::EC2::InternetGateway) on stack unmanaged</span><br/> <span style={{color:'rgb(129,209,219)'}}>igw-06c867a1939f44327</span> (<span style={{color:'rgb(170,170,170)'}}>AWS::EC2::InternetGateway</span>) on stack <span style={{color:'rgb(232,232,232)'}}>unmanaged
igw-0e65d7a67d98849cf (AWS::EC2::InternetGateway) on stack unmanaged</span><br/> <span style={{color:'rgb(129,209,219)'}}>lifeline-1558-igw-2</span> (<span style={{color:'rgb(170,170,170)'}}>AWS::EC2::InternetGateway</span>) on stack <span style={{color:'rgb(232,232,232)'}}>unmanaged
lifeline-abc1-igw-1 (AWS::EC2::InternetGateway) on stack $unmanaged
Initialized pkl project at ’.’
Extracted 9 resources to networking.pkl
formae-auto-recon-inline-1 (AWS::EC2::InternetGateway) on stack unmanaged</span><br/> <span style={{color:'rgb(129,209,219)'}}>formae-auto-recon-standalone-1</span> (<span style={{color:'rgb(170,170,170)'}}>AWS::EC2::InternetGateway</span>) on stack <span style={{color:'rgb(232,232,232)'}}>unmanaged
formae-lgtm-igw (AWS::EC2::InternetGateway) on stack unmanaged</span><br/> <span style={{color:'rgb(129,209,219)'}}>igw-00fda294a8aa7d0ce</span> (<span style={{color:'rgb(170,170,170)'}}>AWS::EC2::InternetGateway</span>) on stack <span style={{color:'rgb(232,232,232)'}}>unmanaged
igw-03ff9cdf7e484fcbe-2 (AWS::EC2::InternetGateway) on stack unmanaged</span><br/> <span style={{color:'rgb(129,209,219)'}}>igw-06c867a1939f44327</span> (<span style={{color:'rgb(170,170,170)'}}>AWS::EC2::InternetGateway</span>) on stack <span style={{color:'rgb(232,232,232)'}}>unmanaged
igw-0e65d7a67d98849cf (AWS::EC2::InternetGateway) on stack unmanaged</span><br/> <span style={{color:'rgb(129,209,219)'}}>lifeline-1558-igw-2</span> (<span style={{color:'rgb(170,170,170)'}}>AWS::EC2::InternetGateway</span>) on stack <span style={{color:'rgb(232,232,232)'}}>unmanaged
lifeline-abc1-igw-1 (AWS::EC2::InternetGateway) on stack $unmanaged
networking.pkl with the resources you selected. formae
creates a PklProject only when there is none anywhere in the directory
hierarchy where you extract. Run extract in a fresh, empty directory and
it scaffolds a starter project (a PklProject pinning the formae and
provider schema packages the resources need, plus a main.pkl) and prints
an “Initialized new Pkl project” line. Run it inside a directory already
covered by a PklProject and formae writes just networking.pkl, reusing
the dependencies already declared there.Usually you extract straight into your existing formae project. When you
do, make sure the new file is reachable: either import networking.pkl
somewhere in your main.pkl include hierarchy, or copy the extracted
resources into a file that is already included. A forma file that nothing
imports is written to disk but never applied.Extracted files need formae
0.88.0 or greater (they use
extends "@formae/forma.pkl"). If your project’s PklProject pins an
older version, extract still writes the file but prints a notice to bump
the formae dependency and run pkl project resolve. See
Schema version compatibility.3
Move them onto a managed stack
Discovered resources sit on formae’s built-in Applying moves them off the
unmanaged stack, so
extract comments the stack label out and leaves you a prompt. Uncomment
it and give the resources a stack of your own (the description comes
pre-filled by extract; keep it or change it):unmanaged stack and onto
imported-networking, where formae manages them.4
Apply, then verify
unmanaged stack and onto imported-networking. Confirm:See also
- Discovery: how formae finds unmanaged resources.
- Resources: managed versus unmanaged.
- Apply modes: what reconcile does when you apply.

