> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formae.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Everyday changes

> The routine operations once your infrastructure is under formae management: inspect it, change it surgically, and tear it down.

Once your infrastructure is under management, most of your work is routine: look
at what you have, find a specific resource, make a small change without disturbing
the rest, and remove what you no longer need. This guide collects those everyday
operations.

## See what formae manages

List everything under management:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae inventory resources --query="managed:true"
```

<div className="fa-term">
  <div className="fa-term-body">  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(232,232,232)',fontWeight:'600'}}>formae</span> <span style={{fontWeight:'600'}} /><span style={{color:'rgb(255,133,51)',fontWeight:'600'}}>inventory</span><br /><span style={{color:'rgb(85,85,102)'}}>────────────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(85,85,102)'}} /> <span style={{color:'rgb(129,209,219)'}}>╭─────────────╮</span><br /> <span style={{color:'rgb(129,209,219)'}}>│</span><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}> 1 Resources </span><span style={{color:'rgb(129,209,219)'}}>│</span>  <span style={{color:'rgb(170,170,170)'}}> 2 Targets </span>  <span style={{color:'rgb(170,170,170)'}}> 3 Stacks </span>  <span style={{color:'rgb(170,170,170)'}}> 4 Policies </span><br /><span style={{color:'rgb(129,209,219)'}}>─╯             ╰────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(129,209,219)'}} /><br /><span style={{color:'rgb(129,209,219)'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}} /><span style={{color:'rgb(232,232,232)',fontWeight:'600'}}>Label ▲                   </span><span style={{color:'rgb(170,170,170)',fontWeight:'600'}}>Stack            Type                          NativeID                           </span><br /><span style={{color:'rgb(85,85,102)'}}>────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(232,232,232)'}} /><span style={{color:'rgb(232,232,232)'}}>lifeline-alb-http-ingress lifeline         AWS::EC2::SecurityGroupIngresssgr-0ffb678dce902c817              </span><br /><span style={{color:'rgb(232,232,232)'}} /><span style={{color:'rgb(232,232,232)'}}>lifeline-alb-sg           lifeline         AWS::EC2::SecurityGroup       sg-00ec7ea75992bcc27               </span><br /><span style={{color:'rgb(232,232,232)'}}>lifeline-igw              lifeline         AWS::EC2::InternetGateway     igw-04356683dcee09288              </span><br /><span style={{color:'rgb(232,232,232)'}}>lifeline-igw-attachment   lifeline         AWS::EC2::VPCGatewayAttachmentIGW|vpc-043bbacbd0ebea8e5          </span><br /><span style={{color:'rgb(232,232,232)'}}>lifeline-public-route     lifeline         AWS::EC2::Route               rtb-01d9445d47e4f00f8|0.0.0.0/0|Ga…</span><br /><span style={{color:'rgb(232,232,232)'}}>lifeline-public-rt        lifeline         AWS::EC2::RouteTable          rtb-01d9445d47e4f00f8              </span><br /><span style={{color:'rgb(232,232,232)'}}>lifeline-public-subnet-1  lifeline         AWS::EC2::Subnet              subnet-0451bdccb16a96a55           </span><br /><span style={{color:'rgb(232,232,232)'}}>lifeline-public-subnet-1-…lifeline         AWS::EC2::SubnetRouteTableAss…rtbassoc-02a56640c3d1fd589         </span><br /><span style={{color:'rgb(232,232,232)'}}>lifeline-public-subnet-2  lifeline         AWS::EC2::Subnet              subnet-05c570615c4b79d89           </span><br /><span style={{color:'rgb(232,232,232)'}}>lifeline-public-subnet-2-…lifeline         AWS::EC2::SubnetRouteTableAss…rtbassoc-0603dbe3b5c152211         </span><br /><span style={{color:'rgb(232,232,232)'}}>lifeline-task-http-ingresslifeline         AWS::EC2::SecurityGroupIngresssgr-0f5bc7f88105a5f70              </span><br /><span style={{color:'rgb(232,232,232)'}}>lifeline-task-sg          lifeline         AWS::EC2::SecurityGroup       sg-037010e17da032dcf               </span><br /><span style={{color:'rgb(232,232,232)'}}>lifeline-vpc              lifeline         AWS::EC2::VPC                 vpc-043bbacbd0ebea8e5              </span><br /><br />Showing 13 of 13 resources (filtered)<br /><span style={{color:'rgb(85,85,102)'}}>────────────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(85,85,102)'}} />  <span style={{color:'rgb(129,209,219)'}}>/</span> <span style={{color:'rgb(170,170,170)'}}>managed:true</span>                                                                                     <span style={{color:'rgb(153,153,153)'}}>/: edit query</span><br /><span style={{color:'rgb(85,85,102)'}}>────────────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(85,85,102)'}} />  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>↑↓/j/k</span><span style={{color:'rgb(153,153,153)'}}>: navigate</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>enter</span><span style={{color:'rgb(153,153,153)'}}>: detail</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>/</span><span style={{color:'rgb(153,153,153)'}}>: search</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>s</span><span style={{color:'rgb(153,153,153)'}}>: sort</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>r</span><span style={{color:'rgb(153,153,153)'}}>: refresh</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>1-4</span><span style={{color:'rgb(153,153,153)'}}>: tab</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>q</span><span style={{color:'rgb(153,153,153)'}}>: quit</span>                       <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>?</span><span style={{color:'rgb(153,153,153)'}}>: help</span></div>
</div>

The list shows every managed resource. Above 200 results formae shows the first 200
and asks you to narrow the query. Filter by `stack`, `type`, `label`, or `target`:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae inventory resources --query="stack:production"
formae inventory resources --query="stack:production type:AWS::EC2::SecurityGroup"
```

`formae inventory` opens on the Resources tab, but it is a tabbed view. Press `1`-`4`
to switch between Resources, Targets, Stacks, and Policies, or run a subcommand to jump
straight to one. `formae inventory stacks` opens on Stacks:

<div className="fa-term">
  <div className="fa-term-body">  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(232,232,232)',fontWeight:'600'}}>formae</span> <span style={{fontWeight:'600'}} /><span style={{color:'rgb(255,133,51)',fontWeight:'600'}}>inventory</span><br /><span style={{color:'rgb(85,85,102)'}}>────────────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(85,85,102)'}} />                             <span style={{color:'rgb(129,209,219)'}}>╭──────────╮</span><br /> <span style={{color:'rgb(170,170,170)'}}> 1 Resources </span>  <span style={{color:'rgb(170,170,170)'}}> 2 Targets </span>  <span style={{color:'rgb(129,209,219)'}}>│</span><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}> 3 Stacks </span><span style={{color:'rgb(129,209,219)'}}>│</span>  <span style={{color:'rgb(170,170,170)'}}> 4 Policies </span><br /><span style={{color:'rgb(129,209,219)'}}>─────────────────────────────╯          ╰───────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(129,209,219)'}} /><br /><span style={{color:'rgb(129,209,219)'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}} /><span style={{color:'rgb(232,232,232)',fontWeight:'600'}}>Label ▲                   </span><span style={{color:'rgb(170,170,170)',fontWeight:'600'}}>Description                                     Policies                            </span><br /><span style={{color:'rgb(85,85,102)'}}>──────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(232,232,232)'}} /><span style={{color:'rgb(232,232,232)'}}>lifeline                  Stack for the lifeline showcase                 none                                </span><br /><br />Showing 1 of 1 stacks<br /><span style={{color:'rgb(85,85,102)'}}>────────────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(85,85,102)'}} />  <span style={{color:'rgb(153,153,153)'}}>/: query</span><br /><span style={{color:'rgb(85,85,102)'}}>────────────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(85,85,102)'}} />  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>↑↓/j/k</span><span style={{color:'rgb(153,153,153)'}}>: navigate</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>enter</span><span style={{color:'rgb(153,153,153)'}}>: detail</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>/</span><span style={{color:'rgb(153,153,153)'}}>: search</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>s</span><span style={{color:'rgb(153,153,153)'}}>: sort</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>r</span><span style={{color:'rgb(153,153,153)'}}>: refresh</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>1-4</span><span style={{color:'rgb(153,153,153)'}}>: tab</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>q</span><span style={{color:'rgb(153,153,153)'}}>: quit</span>                       <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>?</span><span style={{color:'rgb(153,153,153)'}}>: help</span></div>
</div>

`formae inventory targets` opens the Targets tab:

<div className="fa-term">
  <div className="fa-term-body">  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(232,232,232)',fontWeight:'600'}}>formae</span> <span style={{fontWeight:'600'}} /><span style={{color:'rgb(255,133,51)',fontWeight:'600'}}>inventory</span><br /><span style={{color:'rgb(85,85,102)'}}>────────────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(85,85,102)'}} />                <span style={{color:'rgb(129,209,219)'}}>╭───────────╮</span><br /> <span style={{color:'rgb(170,170,170)'}}> 1 Resources </span>  <span style={{color:'rgb(129,209,219)'}}>│</span><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}> 2 Targets </span><span style={{color:'rgb(129,209,219)'}}>│</span>  <span style={{color:'rgb(170,170,170)'}}> 3 Stacks </span>  <span style={{color:'rgb(170,170,170)'}}> 4 Policies </span><br /><span style={{color:'rgb(129,209,219)'}}>────────────────╯           ╰───────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(129,209,219)'}} /><br /><span style={{color:'rgb(129,209,219)'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}} /><span style={{color:'rgb(232,232,232)',fontWeight:'600'}}>Label ▲                  </span><span style={{color:'rgb(170,170,170)',fontWeight:'600'}}>Namespace             Discoverable    Config                                       </span><br /><span style={{color:'rgb(85,85,102)'}}>────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(232,232,232)'}} /><span style={{color:'rgb(232,232,232)'}}>aws-target               AWS                   </span><span style={{color:'rgb(129,209,219)'}}>yes</span>             <span style={{color:'rgb(232,232,232)'}}>Region: us-east-1, Type: AWS                 </span><br /><br />Showing 1 of 1 targets<br /><span style={{color:'rgb(85,85,102)'}}>────────────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(85,85,102)'}} />  <span style={{color:'rgb(153,153,153)'}}>/: query</span><br /><span style={{color:'rgb(85,85,102)'}}>────────────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(85,85,102)'}} />  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>↑↓/j/k</span><span style={{color:'rgb(153,153,153)'}}>: navigate</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>enter</span><span style={{color:'rgb(153,153,153)'}}>: detail</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>/</span><span style={{color:'rgb(153,153,153)'}}>: search</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>s</span><span style={{color:'rgb(153,153,153)'}}>: sort</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>r</span><span style={{color:'rgb(153,153,153)'}}>: refresh</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>1-4</span><span style={{color:'rgb(153,153,153)'}}>: tab</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>q</span><span style={{color:'rgb(153,153,153)'}}>: quit</span>                       <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>?</span><span style={{color:'rgb(153,153,153)'}}>: help</span></div>
</div>

## Find and inspect a resource

Search by any attribute, or combine filters:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae inventory resources --query="label:api-sg"
formae inventory resources --query="stack:production type:AWS::EC2::SecurityGroup"
```

Type queries are case-insensitive; stack and label values are case-sensitive. To
read a resource's full configuration, extract it to Pkl:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae extract --query="label:api-sg" api-sg.pkl
```

## Make a change

Your stack's forma is the source of truth. To change something, edit the resource
in that forma and reconcile: formae compares your forma against what is deployed
and applies just the difference. Reconcile is the mode you reach for on routine
changes, so run `formae apply --mode reconcile`. For urgent one-off fixes during
an incident, reach for patch instead (see [Incidents and recovery](/documentation/guides/incidents-and-recovery)).

<Tabs>
  <Tab title="CLI">
    <Steps>
      <Step title="Edit the forma">
        Change the resource in your stack's forma. For example, scale a deployment
        from one replica to two:

        ```kotlin theme={"languages":{"custom":["/languages/pkl.json"]}}
        spec {
          replicas = 2
          // ...the rest of the deployment unchanged
        }
        ```
      </Step>

      <Step title="Apply">
        ```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
        formae apply --mode reconcile your-stack.pkl
        ```

        formae shows the plan, here a single `spec.replicas` change, and asks you
        to confirm before applying. Use `--yes` to skip the prompt. Reconcile
        compares against the whole stack, so keep the forma complete: a resource
        you remove from it is destroyed.
      </Step>
    </Steps>
  </Tab>

  <Tab title="AI assistants">
    With the [formae MCP plugin](/documentation/guides/ai-coding-assistants)
    connected, describe the change and let the assistant edit the forma and
    reconcile:

    <div className="fa-convo">
      <div className="fa-convo-head">Conversation</div>
      <div className="fa-turn fa-you"><div className="fa-tag">You</div><div className="fa-body">Scale the chat-ui deployment to 2 replicas.</div></div>
      <div className="fa-turn fa-bot"><div className="fa-tag">Assistant</div><div className="fa-body">I'll update the forma and reconcile, simulating first: the plan changes <code>spec.replicas</code> on the <code>chat-ui</code> deployment in <code>vllm-chat</code> from 1 to 2, with nothing else affected. Apply it?</div></div>
      <div className="fa-turn fa-you"><div className="fa-tag">You</div><div className="fa-body">Yes.</div></div>
      <div className="fa-turn fa-bot"><div className="fa-tag">Assistant</div><div className="fa-body">Done. <code>chat-ui</code> is now running 2 replicas.</div></div>
    </div>
  </Tab>
</Tabs>

## Tear down a stack

To remove everything in a stack, destroy it. formae shows the full deletion plan
and asks you to confirm before deleting anything, in dependency order (dependents
before their dependencies):

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae destroy --query="stack:my-app"
```

<div className="fa-term">
  <div className="fa-term-body">  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(232,232,232)',fontWeight:'600'}}>formae</span> <span style={{fontWeight:'600'}} /><span style={{color:'rgb(255,133,51)',fontWeight:'600'}}>destroy</span>                                                                             query: stack:lifeline<br /><span style={{color:'rgb(85,85,102)'}}>────────────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(85,85,102)'}} />  <span style={{color:'rgb(232,232,232)'}}>-</span> 13 <span style={{color:'rgb(232,232,232)'}}>delete</span><br /><br />  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(255,133,51)',fontWeight:'600'}}>▌ Resources</span><br />  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(232,232,232)',fontWeight:'600'}} /><span style={{color:'rgb(232,232,232)',fontWeight:'600'}}>Operation ▲   </span><span style={{color:'rgb(170,170,170)'}}>Label                                                       Type</span><br />  <span style={{color:'rgb(232,232,232)'}}>- delete      lifeline-igw                                                AWS::EC2::InternetGateway</span><br />  <span style={{color:'rgb(170,170,170)'}}>- delete      </span><span style={{color:'rgb(129,209,219)'}}>lifeline-vpc                                                </span><span style={{color:'rgb(170,170,170)'}}>AWS::EC2::VPC</span><br />  <span style={{color:'rgb(170,170,170)'}}>- delete      </span><span style={{color:'rgb(129,209,219)'}}>lifeline-public-rt                                          </span><span style={{color:'rgb(170,170,170)'}}>AWS::EC2::RouteTable</span><br />  <span style={{color:'rgb(170,170,170)'}}>- delete      </span><span style={{color:'rgb(129,209,219)'}}>lifeline-igw-attachment                                     </span><span style={{color:'rgb(170,170,170)'}}>AWS::EC2::VPCGatewayAttachment</span><br />  <span style={{color:'rgb(170,170,170)'}}>- delete      </span><span style={{color:'rgb(129,209,219)'}}>lifeline-task-sg                                            </span><span style={{color:'rgb(170,170,170)'}}>AWS::EC2::SecurityGroup</span><br />  <span style={{color:'rgb(170,170,170)'}}>- delete      </span><span style={{color:'rgb(129,209,219)'}}>lifeline-alb-sg                                             </span><span style={{color:'rgb(170,170,170)'}}>AWS::EC2::SecurityGroup</span><br />  <span style={{color:'rgb(170,170,170)'}}>- delete      </span><span style={{color:'rgb(129,209,219)'}}>lifeline-public-route                                       </span><span style={{color:'rgb(170,170,170)'}}>AWS::EC2::Route</span><br />  <span style={{color:'rgb(170,170,170)'}}>- delete      </span><span style={{color:'rgb(129,209,219)'}}>lifeline-public-subnet-1                                    </span><span style={{color:'rgb(170,170,170)'}}>AWS::EC2::Subnet</span><br />  <span style={{color:'rgb(170,170,170)'}}>- delete      </span><span style={{color:'rgb(129,209,219)'}}>lifeline-public-subnet-2                                    </span><span style={{color:'rgb(170,170,170)'}}>AWS::EC2::Subnet</span><br />  <span style={{color:'rgb(170,170,170)'}}>- delete      </span><span style={{color:'rgb(129,209,219)'}}>lifeline-alb-http-ingress                                   </span><span style={{color:'rgb(170,170,170)'}}>AWS::EC2::SecurityGroupIngress</span><br /><span style={{color:'rgb(153,153,153)'}}>      ↓ show 10 more (3 remaining)</span><br /><br /><span style={{color:'rgb(85,85,102)'}}>────────────────────────────────────────────────────────────────────────────────────────────────────────────────────</span><br /><span style={{color:'rgb(85,85,102)'}} />  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>↑↓</span><span style={{color:'rgb(153,153,153)'}}>: select</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>space</span><span style={{color:'rgb(153,153,153)'}}>: expand</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>→←</span><span style={{color:'rgb(153,153,153)'}}>: column</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>s</span><span style={{color:'rgb(153,153,153)'}}>: sort</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>y</span><span style={{color:'rgb(153,153,153)'}}>: confirm</span>  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>q</span><span style={{color:'rgb(153,153,153)'}}>: abort</span> This operation will delete 13 resource(s).<br />Do you want to continue? (y/N)  <span style={{fontWeight:'600'}} /><span style={{color:'rgb(129,209,219)',fontWeight:'600'}}>?</span><span style={{color:'rgb(153,153,153)'}}>: help</span></div>
</div>

Use `--yes` to skip the confirmation (for scripts). You can also destroy by
pointing at the forma: `formae destroy my-app.pkl`. The stack is removed once its
last resource is gone; unmanaged (discovered) resources are untouched.

## See also

* [Apply modes](/documentation/concepts/apply-modes): patch versus reconcile, and how drift is handled.
* [Stack](/documentation/concepts/stack): how stacks group resources.
* [Explore your infrastructure](/documentation/guides/explore-your-infrastructure): view what is not yet managed.
