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)
  • commandid: the id of the command for which to retrieve the resources
  • managed: true means only resources will be extracted that the user applied previously. false means automatically discovered resources will be extracted. Not setting this flag means both will be extracted

Here are a few examples:

  • formae inventory resources --query='stack:foobar' --output-consumer=machine: retrieve all currently managed resources from the stack foobar for the machine consumer (as JSON)
  • formae inventory resources --query='-stack:foobar': retrieve all currently managed resources from any stack other than foobar
  • formae inventory resources --query='type:aws::ec2::subnet': retrieve all currently managed resources of type subnet
  • formae 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 (true or false)

Here are a few examples:

  • formae inventory targets: retrieve all targets currently configured in formae
  • formae inventory targets --query='namespace:AWS': retrieve all targets in the AWS namespace
  • formae inventory targets --query='discoverable:true': retrieve all targets marked as discoverable
  • formae inventory targets --query='namespace:AWS discoverable:true': retrieve all discoverable AWS targets
  • formae 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 formae
  • formae inventory stacks --output-consumer=machine --output-schema=json: retrieve all stacks in JSON format
  • formae 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 (ttl or auto-reconcile)

Here are a few examples:

  • formae inventory policies: retrieve all reusable policies
  • formae inventory policies --query='type:ttl': retrieve all TTL policies
  • formae inventory policies --query='type:auto-reconcile': retrieve all auto-reconcile policies
  • formae inventory policies --query='label:ephemeral-1h': retrieve a specific policy by label
  • formae 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.