CloudTruth CLI
The CloudTruth CLI tool is used for interacting with the CloudTruth configuration management service. In order to use the CLI you must have an active CloudTruth account.

Installation

The CLI is available as package with a binary executable. Download the version built for your Platform: https://github.com/cloudtruth/cloudtruth-cli/releases/
Here is an installation guide for your preferred distribution that will install the latest version of the CLI.
Shell Install
Debian/Ubuntu
MacOS
Windows
RedHat/CentOS
The shell installer supports Linux and Darwin distros and will install the latest version.
1
(curl -sL https://github.com/cloudtruth/cloudtruth-cli/releases/latest/download/install.sh || wget -qO- https://github.com/cloudtruth/cloudtruth-cli/releases/latest/download/install.sh) | sudo sh
Copied!
You can also specify a version by passing the --version parameter from stdin.
1
(curl -sL https://github.com/cloudtruth/cloudtruth-cli/releases/latest/download/install.sh || wget -qO- https://github.com/cloudtruth/cloudtruth-cli/releases/latest/download/install.sh) | sudo sh -s -- --version 1.0.9
Copied!
Installation commands
1
CLOUDTRUTH_CLI_VERSION=$(curl --silent "https://api.github.com/repos/cloudtruth/cloudtruth-cli/releases/latest" | grep "tag_name" | sed -E 's/.*"([^"]+)".*/\1/')
2
curl -sLOJ https://github.com/cloudtruth/cloudtruth-cli/releases/download/${CLOUDTRUTH_CLI_VERSION}/cloudtruth_${CLOUDTRUTH_CLI_VERSION}_amd64.deb
3
sudo dpkg -i cloudtruth_${CLOUDTRUTH_CLI_VERSION}_amd64.deb
Copied!
Installation commands
1
export CLOUDTRUTH_CLI_VERSION=$(curl --silent "https://api.github.com/repos/cloudtruth/cloudtruth-cli/releases/latest" | grep "tag_name" | sed -E 's/.*"([^"]+)".*/\1/')
2
curl -sLOJ https://github.com/cloudtruth/cloudtruth-cli/releases/download/$CLOUDTRUTH_CLI_VERSION/cloudtruth-$CLOUDTRUTH_CLI_VERSION-x86_64-apple-darwin.tar.gz
3
tar xzf cloudtruth-$CLOUDTRUTH_CLI_VERSION-x86_64-apple-darwin.tar.gz
4
sudo install -m 755 -o root "cloudtruth-$CLOUDTRUTH_CLI_VERSION-x86_64-apple-darwin/cloudtruth" /usr/local/bin
Copied!
These commands will download the Windows executable and extract the contents into your Windows Temp directory then copy the executable to C:\cloudtruth. Run them sequentially.
1
$CLOUDTRUTH_CLI_VERSION = ((Invoke-WebRequest https://api.github.com/repos/cloudtruth/cloudtruth-cli/releases/latest).Content | ConvertFrom-Json).tag_name
2
Invoke-WebRequest -outfile $ENV:TEMP\cloudtruth.zip https://github.com/cloudtruth/cloudtruth-cli/releases/download/$CLOUDTRUTH_CLI_VERSION/cloudtruth-$CLOUDTRUTH_CLI_VERSION-x86_64-pc-windows-msvc.zip
3
Expand-Archive $ENV:TEMP\cloudtruth.zip -DestinationPath $ENV:TEMP
4
copy-item -Path $ENV:Temp\cloudtruth-$CLOUDTRUTH_CLI_VERSION-x86_64-pc-windows-msvc\* C:\cloudtruth\
5
$env:Path += ";C:\cloudtruth"
Copied!
The script will add C:\cloudtruthto your Path for the current PowerShell session. You can either addC:\ cloudtruthto your windows path or execute the CLI directly from C:\cloudtruth.
Coming Soon!

Configuration

The CloudTruth CLI tool has several ways of configuring it, allowing you to pick whichever method is most suitable for your environment. With any method you will need to create a CloudTruth API Access Token to grant the CLI access.
You can configure the CLI using:

Method 1: Environment-based Configuration

The CloudTruth CLI can use supported CLOUDTRUTH_ environment variables that are exported in a local shell. CloudTruth environment variables will merge with and take precedence over a configured CloudTruth configuration file.
Config Options
Usage
CLOUDTRUTH_API_KEY
Required: Authenticates the CLI with the provided CloudTruth API Token.
CLOUDTRUTH_PROFILE
Your profile (which can contain API key, project, and environment)
CLOUDTRUTH_PROJECT
Sets the targeted project.
CLOUDTRUTH_ENVIRONMENT
Sets the targeted environment.
Provide your CloudTruth API Key as an environment variable:
1
export CLOUDTRUTH_API_KEY="YOUR_API_KEY"
Copied!

Method 2: Argument-based Configuration

The CloudTruth CLI can be authorized directly by specifying the option --api-key and providing your API key:
1
cloudtruth --api-key "YOUR_API_KEY"
Copied!
You can prefix commands with a space " " in order to avoid having secret values like the API Key stored in your shell history.

Method 3: File-based Configuration

The CloudTruth CLI stores its configuration in the YAML format.
Run cloudtruth configuration edit to initialize and open the configuration in your default editor.
1
---
2
profiles:
3
default:
4
api_key: <Your personal access token>
5
6
another_profile:
7
source_profile: default
8
api_key: <Another personal access token>
9
project: "Project1"
10
environment: "staging"
Copied!
You can have multiple named profiles in your configuration, allowing you to maintain multiple sets of configuration fields in the configuration file. Values can be inherited from one profile to another by setting the source_profile configuration field. Profiles without an explicit source_profile configuration implicitly inherit from the default profile. Use a specific profile with the --profile option.
1
cloudtruth --profile another-profile <subcommand>
Copied!
If the --profile argument is not supplied, the profile named default will be used.
Alternatively, you can use the cloudtruth configuration profiles command to create or edit profiles.
1
cloudtruth configuration profiles set default --api-key "YOUR_API_KEY"
2
3
cloudtruth configuration profiles set demo-stage --proj MyFirstProject --env staging --desc "Demo Project Staging Environemnt"
Copied!
The created configuration file is named cli.yml and resides in the standard application configuration location for your platform:
  • Linux -> $XDG_CONFIG_HOME/cloudtruth/cli.yml
  • macOS -> $HOME/Library/Application Support/com.cloudtruth.CloudTruth-CLI/cli.yml
  • Windows -> %AppData%\CloudTruth\CloudTruth CLI\config\cli.yml

Running

Once you have the application configured with your CloudTruth API key, you can interact with your CloudTruth parameters. The CloudTruth CLI uses a subcommand structure to scope available actions as appropriate for a given resource.

Switching the active CloudTruth Project and Environment

CloudTruth Project

You must select a target project for the CLI with the --project option:
1
cloudtruth --project YOUR_PROJECT
Copied!

CloudTruth Environment

By default, all commands will run against the default CloudTruth environment. To change the target environment, you can supply use--env option:
1
cloudtruth --project MyFirstProject --env YOUR_ENVIRONMENT
Copied!

CloudTruth run

The CloudTruth run command allows you to use parameters stored in CloudTruth and pass them through to your applications.
run options
Description
-c, --command
Run this command
--as-of
Date/time of parameter value(s)
-i, --inherit
Handle the relationship between local and CloudTruth environments [default: overlay] [possible values: none, underlay, overlay, exclusive]
r, --remove
Remove the variables from the CloudTruth environment for this run
-s, --set
Set the variables in this run, even possibly overriding the CloudTruth environment
You can issue the cloudtruth run command with printenv to print all of your local and CloudTruth parameters.
1
cloudtruth --project MyFirstProject run --command printenv
Copied!

Inheritance

By default the run command will overlay all CloudTruth and local parameters into your command. You can use the --inherit option to change the behavior. This example will only passthrough CloudTruth parameters:
1
cloudtruth --project MyFirstProject run --inherit none --command printenv
Copied!

Run time parameters

The run command will also allow you to remove or set parameters to customize a specific workflow in real time.
1
cloudtruth --project MyFirstProject run --inherit none --command printenv --set NEW_VALUE=Production --remove SOME_VALUE
Copied!

Usage Examples

Listing objects such as projects, environments and parameters will return a list of names. For detailed information use the values flag-v, --values.
Create a new parameter and set a value. To mark the value as a secret use the --secret flag.
1
cloudtruth --project MyFirstProject parameters set PARAMETER_KEY --value SOME_VALUE
Copied!
View a list of all parameters with values.
1
cloudtruth --project MyFirstProject parameters list --values
Copied!
Retrieve a specific parameter value by key name
1
cloudtruth --project MyFirstProject parameter get PARAMETER_KEY
Copied!
Retrieve overrides for specific parameter values across environments.
1
cloudtruth --project MyFirstProject parameter environment PARAMETER_KEY
Copied!
Show differences with parameter values across two environments.
1
cloudtruth --project MyFirstProject parameter differences --env staging --env production
Copied!
View a tree view of all environments.
1
cloudtruth --project MyFirstProject environments tree
Copied!
Retrieve the contents of a project template.
1
cloudtruth --project MyFirstProject template get "TEMPLATE_NAME"
Copied!

Command List

You can also get auto-completions for most popular shells by running:
source <(cloudtruth completions <SHELL>), where "SHELL" is the name of your shell.
Flags
Description
-h, --help
Prints help information
-V, --version
Prints version information
Options
Description
-k, --api-key
CloudTruth API key
-e, --env
The CloudTruth environment to work with
--profile
The configuration profile from the application configuration file to use
--project
The CloudTruth project to work with
command
subcommand
Description
audit-logs
Display audit logs [aliases: audit, aud, a, log, logs]
list
List audit log details [aliases: ls, l]
summary
Display summary of audit logs [aliases: sum]
completions
Generate shell completions for this application
configuration
Configuration options for this application [aliases: config, conf, con]
current
Show the current arguments and their sources. [aliases: curr, cur]
edit
Edit your configuration data for this application
profiles
Work with CloudTruth CLI profiles [aliases: profile, prof, pr, p]
environments
Work with CloudTruth environments [aliases: environment, envs, env, e]
delete
Delete specified CloudTruth environment [aliases: del, d]
list
List CloudTruth environments [aliases: ls, l]
set
Create/update a CloudTruth environment [aliases: s]
tag
View and manipulate environment tags [aliases: ta]
tree
Show a tree representation of the environments [aliases: tr, t]
help
Prints this message or the help of the given subcommand(s)
integrations
Work with CloudTruth integrations [aliases: integration, integrate, integ, int]
explore
Explore integrations by Fully Qualified Name (FQN). [aliases: exp, ex, e]
list
List CloudTruth integrations [aliases: ls, l]
login
Sets up a CloudTruth configuration profile api_key
logout
Removes a CloudTruth configuration profile api_key
parameters
Work with CloudTruth parameters [aliases: parameter, params, param, p]
delete
Delete the parameter from the project [aliases: del, d]
differences
Show differences between properties from two environments [aliases: difference, differ, diff]
environment
Shows values across environments [aliases: environ, env]
export
Export selected parameters to a known output format. Exported parameters are limited to alphanumeric and underscore in key names. Formats available are: dotenv, docker, and shell.
get
Gets value for parameter in the selected environment
list
List CloudTruth parameters [aliases: ls, l]
set
Set a value in the selected project/environment for an existing parameter or creates a new one if needed
unset
Remove a value/override from the selected project/environment and leaves the parameter in place.
projects
Work with CloudTruth projects [aliases: project, proj]
delete
Delete specified CloudTruth project [aliases: del, d]
list
List CloudTruth projects [aliases: ls, l]
set
Create/update a CloudTruth project
tree
Display CloudTruth project inheritance [aliases: tr]
run
Run a shell with the parameters in place [aliases: run, r]
templates
Work with CloudTruth templates [aliases: template, temp, t]
delete
Delete the CloudTruth template [aliases: del, d]
differences
Show differences between templates [aliases: difference, differ, diff, di]
edit
Edit Edit the specified template [aliases: ed, e]
get
Get an evaluated template from CloudTruth
history
Display template history [aliases: hist, h]
list
List CloudTruth templates [aliases: ls, l]
preview
Evaluate the provided template without storing [aliases: prev, pre]
set
Set the CloudTruth template
validate
Validate a CloudTruth template [aliases: valid, val, v]
users
Work with CloudTruth users [aliases: user, us]
current
Display information about current user [aliases: cur, c]
delete
Delete specified CloudTruth account [aliases: del, d]
get
Get detailed CloudTruth user information
invitations
Manage user invitations [aliases: invitation, invite, inv, in, i]
list
List CloudTruth users [aliases: ls, l]
set
Create/update a CloudTruth service account [aliases: s]

Issue Reporting

The CloudTruth CLI is open source. You can report issues and get details on building and developing locally in the CloudTruth CLI repo.
Issues · cloudtruth/cloudtruth-cli
GitHub
Last modified 27d ago