env zero CLI
The env zero CLI provides a command-line interface for managing your cloud environments and deployments directly from your local machine. This guide walks you through installing, configuring, and using the CLI to build custom workflows while maintaining all the governance and visibility that env zero provides.Prerequisites
Before you begin, ensure you have:- Node.js installed on your local machine
- An env zero account with appropriate permissions
- Access to create API keys in your organization
Step 1: Install the CLI
Install the env zero CLI globally using npm or yarn:Step 2: Create API credentials
Navigate to your env zero organization settings to create API credentials:- Go to Organization → Settings → API Keys
- Click Add API Key
- Enter a descriptive name for your key
- Copy and save both the API Key ID and secret
Save your API Key ID and secret immediately - the secret will not be available after you close this window.
Step 3: Configure the CLI
Configure the CLI with your credentials and organization details:- API Key ID
- API Key Secret
- Organization ID
- Project ID (optional)
- Blueprint ID (optional)
If you don’t know your organization, project, or blueprint IDs, you can find them in the env0 UI. The CLI will help you discover these values during configuration.
Step 4: Deploy your first environment
Deploy an environment using the CLI:- Git clone
- Terraform init
- Terraform plan
- Terraform apply
Step 5: Use approval workflows
For deployments that require approval, use the-a
flag:
Step 6: Destroy environments
Destroy environments when they’re no longer needed:Advanced usage
The env zero CLI supports many additional commands and options. For complete documentation including:- All available commands and flags
- Advanced configuration options
- Integration examples
- Troubleshooting guides
Complete env zero CLI documentation
Read the full blog post with detailed command reference, advanced examples, and workflow demonstrations.
Next steps
- API Reference - Complete API documentation
- Getting Started Guide - Learn the basics of env zero
- Workflows - Advanced workflow configuration