The command-line tool for the env0 platform.
- deploy - Creates a new environment or deploy an existing environment.
- destroy - Destroys an existing environment.
- approve - Resumes a deployment that awaits an approval.
- cancel - Cancels a deployment that awaits an approval.
$ yarn global add @env0/cli # or $ npm install -g @env0/cli
env0 help to get a helpful list of supported commands and arguments.
env0 configure <arguments>
Sets configurable options for the CLI. If no arguments are given, displays a set of prompts that will help you configure the CLI options.
env0 deploy <arguments>
Initiates a new deployment on env0, whether for a new environment or for an existing one.
env0 destroy <arguments>
Initiates a new deployment to destroy and existing environment.
env0 approve <arguments>
Runs an approval of an existing deployment that is waiting to be approved (AKA waiting in plan stage).
env0 cancel <arguments>
Cancels an existing deployment that is waiting to be approved (AKA waiting in plan stage).
The arguments are loaded from env0 configuration files, environment variables and CLI parameters. The order of precedence of the arguments is:
env0CLI explicit parameters
- Environment Variables
- Configuration File
env0 API Key (Required)
env0 API Secret (Required)
env0 Organization ID (Required)
env0 Project ID (Required)
The Blueprint ID you would like to deploy with (Required for new environments)
The environment name you would like to create, or deploy to an existing one (Required for existing environments)
(Optional) - A name for Terraform Workspace created for your new environment. This cannot be changed after an environment was created
The environment variables to set on the deployed environment - works only on deploy and can be multiple, the format is "environmentVariableName1=value"
For sensitive environment variables, use:
The terraform variables to set on the deployed environment - works only on deploy and can be multiple, the format is "terraformVariableName1=value"
Your GIT revision, can be a branch, a tag or a commit hash. (For existing environments - if not specified, will use the previously defined revision)
Requires approval for deployment. Valid values are either "true" or "false".
Skip State Refresh
Disable automatic state refresh on 'plan -destroy' phase.
Targets (Partial Apply)
A list of resources to explicitly include in the deployment, delimited by a comma. Format is "resource1,resource2,resource3"
After initial deployment, a configuration file will be created under
This file holds your last action's required parameters and will spare you from re-configuring the required parameters on every action.
Supported Environment Variables
Compiling from Source
You can compile and run the CLI from source by cloning the repo from Github and then running the following:
# Clone the repo from github # Make sure env0 lib is not installed globally npm install npm link # link your local copy of the CLI to your terminal path
export ENV0_API_URL=https://api-serverto change the API URL
Default url is set to