Skip to main content

infrahubctl

infrahubctl is a command line utility designed to help with the day to day management of an Infrahub installation. It's meant to run on any laptop or server and it communicates with a remote Infrahub server over the network.

infrahubctl can help you to:

  • Manage the branches in Infrahub: List, Create, Merge, Rebase, Delete.
  • Manage the schema and load new schema files into Infrahub.
  • Execute any Python script that requires access to the Python SDK.
  • Render a Jinja Template locally for troubleshooting.
  • Execute a GraphQL query store in a Git repository for troubleshooting.
  • Validate that input files conform with the format expected by Infrahub.

Installation

The infrahubctl command line utility is installed as a part of the Infrahub SDK for Python.

Configuration

infrahubctl requires a minimum configuration in order to connect to the right Infrahub server with the correct credentials. These settings can be provided either in a configuration file, infrahubctl.toml, or via environment variables.

Environment variables

NameExample value
INFRAHUB_ADDRESShttp://localhost:8000
INFRAHUB_API_TOKEN06438eb2-8019-4776-878c-0941b1f1d1ec
INFRAHUB_DEFAULT_BRANCHmain

You can also provide the location of a configuration file via the environment variable INFRAHUBCTL_CONFIG.

infrahubctl.toml file

infrahubctl.toml
server_address="http://localhost:8000"
api_token="06438eb2-8019-4776-878c-0941b1f1d1ec"