Skip to content

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.