TECLI is a powerful command-line interface designed to interact with Terraform Cloud API. It enhances team productivity by providing intuitive commands that can be executed in a terminal or integrated into CI/CD pipelines.
In a world where infrastructure as code is becoming the standard, TECLI bridges the gap between your workflows and Terraform Cloud, making it easier to manage workspaces, runs, variables, and more.
- Workspace Management: Create, read, update, delete, and list Terraform workspaces
- Run Operations: Create, apply, and discard Terraform runs
- Plan & Apply Management: View logs for plan and apply operations
- Variable Management: Create, update, and delete Terraform and environment variables
- VCS Integration: Connect workspaces to version control repositories
- SSH Key Management: Manage SSH keys for private module access
- OAuth Client Management: Configure OAuth clients for VCS providers
- Installation
- Configuration
- Usage Examples
- Command Reference
- Common Workflows
- Screenshots
- Contributing
- References
- License
Before installing TECLI, ensure you have:
- A Terraform Cloud/Enterprise account
- Appropriate API tokens (user, team, or organization)
For more detailed prerequisites, visit our Pre-Requisites Wiki.
- Download the latest release for your operating system and platform.
- Extract the binary to a location in your PATH.
- Verify the installation:
tecli version
For more detailed installation instructions, visit our Installation Wiki.
TECLI requires configuration before use. You can configure it in two ways:
tecli configure create
This interactive command will guide you through setting up your profile with:
- Organization name
- User token
- Team token
- Organization token
# Linux/macOS
export TFC_ORGANIZATION=your-organization
export TFC_USER_TOKEN=your-user-token
export TFC_TEAM_TOKEN=your-team-token
export TFC_ORGANIZATION_TOKEN=your-organization-token
# Windows (PowerShell)
$Env:TFC_ORGANIZATION="your-organization"
$Env:TFC_USER_TOKEN="your-user-token"
$Env:TFC_TEAM_TOKEN="your-team-token"
$Env:TFC_ORGANIZATION_TOKEN="your-organization-token"
tecli <resource> <action> [flags]
tecli workspace list --organization=your-organization
tecli workspace find-by-name --organization=your-organization --name=your-workspace-name
tecli workspace create --organization=your-organization --name=your-workspace-name --allow-destroy-plan=true
# First, get the OAuth Token ID
tecli o-auth-token list --organization=your-organization
# Then create the workspace with VCS connection
tecli workspace create \
--organization=your-organization \
--name=your-workspace-name \
--vcs-repo-oauth-token-id=your-oauth-token-id \
--vcs-repo-identifier=org/repo
# Create a configuration version
tecli configuration-version create --workspace-id=your-workspace-id
# Upload configuration files
tecli configuration-version upload --url=your-upload-url --path=./
# Create a run
tecli run create --workspace-id=your-workspace-id --comment="Your comment"
# Check run status
tecli run read --id=your-run-id
# Apply the run
tecli run apply --id=your-run-id --comment="Apply comment"
# Create a sensitive Terraform variable
tecli variable create \
--key=your-variable-key \
--value=your-variable-value \
--workspace-id=your-workspace-id \
--category=terraform \
--sensitive=true
# Create AWS environment variables
tecli variable create --key=AWS_ACCESS_KEY_ID --value=your-access-key --workspace-id=your-workspace-id --category=env --sensitive=true
tecli variable create --key=AWS_SECRET_ACCESS_KEY --value=your-secret-key --workspace-id=your-workspace-id --category=env --sensitive=true
tecli variable create --key=AWS_DEFAULT_REGION --value=your-region --workspace-id=your-workspace-id --category=env --sensitive=true
TECLI provides the following main commands:
Available Commands:
apply An apply represents the results of applying a Terraform Run's execution plan.
configuration-version A configuration version is a resource used to reference the uploaded configuration files.
configure Configures tecli settings
help Help about any command
o-auth-client An OAuth Client represents the connection between an organization and a VCS provider.
o-auth-token The oauth-token object represents a VCS configuration which includes the OAuth connection and the associated OAuth token.
plan A plan represents the execution plan of a Run in a Terraform workspace.
run A run performs a plan and apply, using a configuration version and the workspace's current variables.
ssh-key The ssh-key object represents an SSH key which includes a name and the SSH private key.
variable Operations on variables.
version Displays the version of tecli and all installed plugins
workspace Workspaces represent running infrastructure managed by Terraform.
For detailed information about a specific command:
tecli [command] --help
# Create a workspace
tecli workspace create --organization=your-org --name=your-workspace
# Create a configuration version
tecli configuration-version create --workspace-id=your-workspace-id
# Upload configuration files
tecli configuration-version upload --url=your-upload-url --path=./
# Create a run
tecli run create --workspace-id=your-workspace-id --comment="Initial run"
# Monitor run status
tecli run read --id=your-run-id
# View plan logs
tecli plan logs --id=your-plan-id
# Apply the run
tecli run apply --id=your-run-id --comment="Applying changes"
# View apply logs
tecli apply logs --id=your-apply-id
# Bash script to wait for run completion
while true; do
STATUS=$(tecli run read --id=your-run-id | jq -r ".Status")
if [ "${STATUS}" != "pending" ]; then
break
else
echo "RUN STATUS:${STATUS}, IF 'pending' TRY DISCARD PREVIOUS PLANS. SLEEP 5 seconds" && sleep 5
fi
done
Click to expand screenshots
![]() |
---|
How to configure |
![]() |
---|
How to create a workspace |
![]() |
---|
How to create a workspace linked to a repository |
![]() |
---|
How to create a run |
![]() |
---|
How to read plan logs |
![]() |
---|
How to read apply logs |
![]() |
---|
How to delete a workspace |
We welcome contributions to TECLI! Please read our Contributing Guidelines for details on how to submit pull requests, report issues, and suggest improvements.
Name | Role | |
---|---|---|
Silva, Valter | valterh@amazon.com | AWS Professional Services - Cloud Architect |
Dhingra, Prashit | AWS Professional Services - Cloud Architect |
- Terraform Cloud - Terraform Cloud is an application that helps teams use Terraform together.
- Terraform Cloud/Enterprise Go Client - The official Go API client for Terraform Cloud/Enterprise.
- clencli - Cloud Engineer CLI
- terminalizer - Record your terminal and generate animated gif images or share a web player link terminalizer.com
This project is licensed under the Apache License 2.0. For more information, please read LICENSE.
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
Photo by Gabriel Menchaca on Unsplash