Skip to content

extract command

This command facilitates the extraction of a stack as forma. The extracted forma serves multiple purposes: visual inspection, application of transformational operations, or persistent storage within version control systems for subsequent utilization. This extraction process essentially materializes the abstract stack configuration into a tangible, manipulable artifact.

Usage

formae extract [OPTIONS] <forma file>

Options

Option Description
--output-schema Output schema. Possible values are: pkl [default: "pkl"]
--query Query that allows to find resources by their attributes [default: " "]
--yes Overwrite existing files without prompting [default: "false"]

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 extract --query='stack:foobar' ./foo.pkl: extract all currently managed resources from the stack foobar as Pkl into ./foo.pkl
  • formae extract --query='type:aws::ec2::subnet' ./foo.pkl: retrieve all currently managed resources of type subnet as Pkl into ./foo.pkl
  • formae extract ./foo.pkl: retrieve all resources currently managed by formae as Pkl into ./foo.pkl

Schema

Output schema determines the output schema.