inventory command
This command allows you to query inventory.
Usage
formae inventory [COMMAND]
Resources inventory
Usage
formae inventory resources [OPTIONS]
Options
| Option | Description |
|---|---|
--max-results |
Maximum number of resources to display in the table (0 = unlimited) [default: 10] |
--output-consumer |
Consumer of the command result (human | machine) [default: "human"] |
--output-schema |
The schema to use for the machine output (json | yaml). Only relevant for the "machine" output-consumer [default: "json"] |
--query |
Query that allows to find resources by their properties [default: ""] |
Consumer
Currently, there are two consumers:
- human (default): The CLI assumes a human user is interacting with it. Output is less strictly formatted and more verbose
- machine: The CLI assumes the data printed to stdout will be processed by a machine or another tool
Query
This command, using the --query flag, allows you to search and retrieve resources managed by formae. The query language is simple and is described in detail here.
Following fields are available for search:
stack: the stack that the extracted resources need to belong to (case sensitive)label: the label of the resource (case sensitive)type: the type of the resource (case insensitive)target: the target the resource belongs to (case sensitive)commandid: the id of the command for which to retrieve the resourcesmanaged:truemeans only resources will be extracted that the user applied previously.falsemeans automatically discovered resources will be extracted. Not setting this flag means both will be extracted
Combining terms. Different fields combine with AND; repeating the same field combines with OR. stack:web stack:api returns resources in either stack, and type:AWS::S3::Bucket stack:prod stack:staging returns S3 buckets in either prod or staging. The exclusion form (-stack:tmp) also accepts repetition.
Wildcards. All string-valued fields (stack, label, type, target) accept * as a prefix or suffix wildcard — for example label:prod-* or type:AWS::S3::*. Only * is supported; ? is rejected, and a bare * is not allowed: every wildcard must be anchored to at least one literal character.
Here are a few examples:
formae inventory resources --query='stack:foobar' --output-consumer=machine: retrieve all currently managed resources from the stackfoobarfor the machine consumer (as JSON)formae inventory resources --query='-stack:foobar': retrieve all currently managed resources from any stack other thanfoobarformae inventory resources --query='type:aws::ec2::subnet': retrieve all currently managed resources of typesubnetformae inventory resources --query='stack:prod stack:staging': retrieve resources from either stackformae inventory resources --query='label:web-*': retrieve resources whose label starts withweb-formae inventory resources --query='target:aws-prod': retrieve resources on theaws-prodtargetformae inventory resources: retrieve all resources currently managed by formae
Human output
This command outputs a tabular summary of resources in question.
Targets inventory
Usage
formae inventory targets [OPTIONS]
Options
| Option | Description |
|---|---|
--max-results |
Maximum number of targets to display in the table (0 = unlimited) [default: 10] |
--output-consumer |
Consumer of the command result (human | machine) [default: "human"] |
--output-schema |
The schema to use for the machine output (json | yaml) [default: "json"] |
--query |
Query that allows to find targets by their attributes [default: ""] |
Consumer
Currently, there are two consumers:
- human (default): The CLI assumes a human user is interacting with it. Output is less strictly formatted and more verbose
- machine: The CLI assumes the data printed to stdout will be processed by a machine or another tool
Query
This command, using the --query flag, allows you to search and retrieve targets configured in formae. The query syntax is simple: key:value pairs separated by spaces.
Following fields are available for search:
label: the label of the target (exact match, case sensitive)namespace: the namespace of the target (exact match, case sensitive)discoverable: whether the target is marked as discoverable (trueorfalse)
Here are a few examples:
formae inventory targets: retrieve all targets currently configured in formaeformae inventory targets --query='namespace:AWS': retrieve all targets in the AWS namespaceformae inventory targets --query='discoverable:true': retrieve all targets marked as discoverableformae inventory targets --query='namespace:AWS discoverable:true': retrieve all discoverable AWS targetsformae inventory targets --output-consumer=machine --output-schema=json: retrieve all targets in JSON format
Human output
This command outputs a tabular summary of targets in question.
Stacks inventory
Usage
formae inventory stacks [OPTIONS]
Options
| Option | Description |
|---|---|
--max-results |
Maximum number of stacks to display in the table (0 = unlimited) [default: 10] |
--output-consumer |
Consumer of the command result (human | machine) [default: "human"] |
--output-schema |
The schema to use for the machine output (json | yaml) [default: "json"] |
Consumer
Currently, there are two consumers:
- human (default): The CLI assumes a human user is interacting with it. Output is less strictly formatted and more verbose
- machine: The CLI assumes the data printed to stdout will be processed by a machine or another tool
Examples
formae inventory stacks: retrieve all stacks currently managed by formaeformae inventory stacks --output-consumer=machine --output-schema=json: retrieve all stacks in JSON formatformae inventory stacks --max-results=0: retrieve all stacks without limiting results
Human output
This command outputs a tabular summary of stacks, including their label, description, and attached policies.
Policies inventory
Usage
formae inventory policies [OPTIONS]
Options
| Option | Description |
|---|---|
--max-results |
Maximum number of policies to display in the table (0 = unlimited) [default: 10] |
--output-consumer |
Consumer of the command result (human | machine) [default: "human"] |
--output-schema |
The schema to use for the machine output (json | yaml) [default: "json"] |
--query |
Query that allows to find policies by their attributes [default: ""] |
Consumer
Currently, there are two consumers:
- human (default): The CLI assumes a human user is interacting with it. Output is less strictly formatted and more verbose
- machine: The CLI assumes the data printed to stdout will be processed by a machine or another tool
Query
This command, using the --query flag, allows you to search and retrieve policies configured in formae. The query syntax is simple: key:value pairs separated by spaces.
Following fields are available for search:
label: the label of the policy (exact match, case sensitive)type: the type of the policy (ttlorauto-reconcile)
Here are a few examples:
formae inventory policies: retrieve all reusable policiesformae inventory policies --query='type:ttl': retrieve all TTL policiesformae inventory policies --query='type:auto-reconcile': retrieve all auto-reconcile policiesformae inventory policies --query='label:ephemeral-1h': retrieve a specific policy by labelformae inventory policies --output-consumer=machine --output-schema=json: retrieve all policies in JSON format
Human output
This command outputs a tabular summary of reusable policies, including their label, type, and configuration details.
Note: This command only lists reusable (standalone) policies. Inline policies are shown as part of their owning stack in
formae inventory stacks.