Terraform Cloud CLI

Terraform Cloud CLI encompasses a set of command line tools that bridge the gap between local Terraform workflows and the Terraform Cloud control plane. Terraform Cloud is the SaaS offering from HashiCorp that hosts remote state, runs plan and apply operations, and manages workspaces, variables, and collaboration. While HashiCorp provides official CLI integration via the cloud block and the CLI-driven Run Workflow, the community has built complementary interactive CLIs that operate directly on Terraform Cloud resources from the terminal. This article covers the two most cited community CLIs, terraform-cloud and tfccli, alongside the core Terraform CLI commands that underpin any Cloud workflow, and the Azure-focused installation guidance that is commonly referenced for Windows users.

Terraform Cloud CLI Landscape

Terraform Cloud provides an API and UI for managing infrastructure as code at scale. The Terraform CLI interacts with it through a remote backend configuration and a cloud block in configuration files. Users define infrastructure in declarative HCL configuration files, preview changes with an execution plan, and apply the plan to deploy infrastructure. That core loop is init, plan, apply.

In practice, operators need to interact with Terraform Cloud resources themselves: workspaces, runs, state, variables. The official Terraform CLI is focused on managing infrastructure configurations in Terraform files, previewing changes to the Terraform plan, and deploying changes to the Terraform application. The CLI interacts with multiple infrastructure providers to provide state management and modularization of arrangement for efficient infrastructure automation.

Two community tools extend this capability with dedicated Terraform Cloud command line interfaces.

terraform-cloud by bendrucker

terraform-cloud is an interactive CLI that helps automate complex and repetitive tasks in Terraform Cloud. It is designed to compliment the Terraform Enterprise Provider. The tfe provider can manage teams, workspaces, variables, and other Terraform Cloud resources. This CLI is not focused on being a complete API client.

Status: Early development. You will likely encounter bugs. Breaking changes will bump the 0.x version until version 1.0.0.

Binaries are available for each tagged release. Download an appropriate binary for your operating system and install it into $PATH.

You can also install with Homebrew:

brew tap bendrucker/terraform-cloud-cli brew install terraform-cloud-cli

Usage:

terraform-cloud [--version] [--help] <command> [<args>]

Available commands are:

  • migrate Migrate a Terraform module from an existing backend to Terraform Cloud
  • open Opens the Terraform Cloud UI to the workspace

Migrate command details:

terraform-cloud migrate [options]

Migrate a Terraform module from an existing backend to Terraform Cloud

Options:

  • --hostname string
    Hostname for Terraform Cloud
  • --modules string
    A directory where other Terraform modules are stored

The migrate command is intended for moving existing modules that use a local or other remote backend to Terraform Cloud. The hostname option allows targeting a specific Terraform Cloud instance, and the modules option points to a directory where other Terraform modules are stored.

The open command opens the Terraform Cloud UI to the workspace, providing a fast way to move from terminal operations to the web console.

tfccli by richclement

Terraform Cloud API. One CLI.

Terraform Cloud in your terminal. Manage workspaces, trigger runs, inspect state, and configure variables—all from the command line.

Install options:

  • Homebrew tap, binary download, or build from source.

Homebrew recommended:

brew install richclement/tap/tfccli

Go Install:

go install github.com/richclement/tfccli/cmd/tfccli@latest

Binary Download:

curl -sSL https://github.com/richclement/tfccli/releases/latest/download/tfccli_$(uname -s)_$(uname -m).tar.gz | tar xz

For AI Agents:

npx skills add richclement/tfccli

Example usage:

tfccli workspace list

Output:

NAME STATUS LAST RUN production applied 2h ago staging applied 4h ago

Run creation example:

tfccli run create --workspace production

Run RUN-abc123 queued. Watching...

tfccli is positioned as a unified CLI for Terraform Cloud operations. It supports workspace listing, run creation and watching, state inspection, and variable configuration directly from the terminal.

Core Terraform CLI Commands

The Terraform CLI is a tool that HashiCorp offers for managing infrastructure as code. Users can define infrastructure configurations in Terraform files, preview changes to the Terraform plan, and deploy changes to the Terraform application.

Terraform files are used to define infrastructure configurations. Terraform init is used to initialize the working directory. Terraform plan is used to plan changes, and Terraform apply is used to apply changes.

Check Terraform Version Using Single Command

To find out more about the Terraform version that is presently installed, use the command terraform version.

Command table:

Command Description
terraform --version Utilizing a common format, create Terraform configuration files.

What Is Terraform CLI

The Terraform CLI is a tool that HashiCorp offers for managing infrastructure as code. Users can define infrastructure configurations in Terraform files, preview changes to the Terraform plan, and deploy changes to the Terraform application. The CLI interacts with multiple infrastructure providers to provide state management and modularization of arrangement for efficient infrastructure automation.

With Terraform, users can automate the deployment and administration of cloud infrastructure across numerous providers. For more details about Terraform go to the linked page.

Terraform Init Plan Apply Workflow

terraform init
Purpose
terraform init
initializes a Terraform working directory. It downloads required provider plugins, initializes modules, and configures the backend where state files are stored.

Real-World Example
You create a new project to deploy AWS infrastructure:
terraform init
Terraform will:
- Download the AWS provider
- Initialize the S3 backend if configured
- Prepare the directory for further commands
This command must be run first before planning or applying changes.

terraform plan
Purpose
terraform plan
shows what Terraform will change without actually modifying infrastructure

The plan command generates an execution plan that allows you to preview your infrastructure changes before they're deployed. Once you verify the changes, you apply the execution plan to deploy the infrastructure.

The workflow sequence is:

  • terraform init to prepare the working directory
  • terraform plan to preview changes
  • terraform apply to deploy changes

Declarative configuration files allow users to design and provision infrastructure resources. With Terraform, users can automate the deployment and administration of cloud infrastructure across numerous providers.

Terraform Cloud Integration and Remote Backend

Terraform enables the definition, preview, and deployment of cloud infrastructure. Using Terraform, you create configuration files using HCL syntax. The HCL syntax allows you to specify the cloud provider - such as Azure - and the elements that make up your cloud infrastructure.

After you create your configuration files, you create an execution plan that allows you to preview your infrastructure changes before they're deployed. Once you verify the changes, you apply the execution plan to deploy the infrastructure.

Previous versions can use the remote backend. Refer to Migrating from the remote backend for details about switching to the CLI integration.

Connect to HCP Terraform documents the cloud block that you must add to your configuration to enable HCP Terraform support. Command Line Arguments lists the Terraform command flags that are specific to using Terraform with HCP Terraform.

Refer to the CLI-driven Run Workflow for more details about how to use HCP Terraform from the command line.

Azure Setup and Authentication on Windows

This article presents you with the options to authenticate to Azure for use with Terraform.

In this article you learn how to:
- Install the Git Bash terminal emulator
- Install Azure CLI
- Install Terraform
- Configure your environment to run Terraform on Windows
- Understand common Terraform and Azure authentication scenarios
- Authenticate via a Microsoft account from Cloud Shell using Bash or PowerShell
- Authenticate via a Microsoft account from Windows using Bash or PowerShell
- Create a service principal using the Azure CLI
- Create a service principal using Azure PowerShell
- Specify service principal credentials in environment variables
- Specify service principal credentials in a Terraform provider block

Azure subscription: If you don't have an Azure subscription, create a free account before you begin.

Install a terminal emulator
There are many options on Windows to run bash commands, including Git Bash and Windows Terminal

The guidance covers installing Git Bash terminal emulator, installing Azure CLI, installing Terraform, and configuring the environment to run Terraform on Windows.

Installation Methods Comparison

Tool Install Method Primary Focus
terraform-cloud brew tap bendrucker/terraform-cloud-cli; brew install terraform-cloud-cli Migrate modules to Terraform Cloud, open workspace UI
terraform-cloud Binary download per tagged release into $PATH Migrate modules to Terraform Cloud, open workspace UI
tfccli brew install richclement/tap/tfccli Manage workspaces, trigger runs, inspect state, configure variables
tfccli go install github.com/richclement/tfccli/cmd/tfccli@latest Manage workspaces, trigger runs, inspect state, configure variables
tfccli curl binary download Manage workspaces, trigger runs, inspect state, configure variables

Command comparison:

CLI Example Command
terraform-cloud terraform-cloud migrate --hostname string --modules string
terraform-cloud terraform-cloud open
tfccli tfccli workspace list
tfccli tfccli run create --workspace production
Terraform terraform version
Terraform terraform init
Terraform terraform plan
Terraform terraform apply

Conclusion

The Terraform Cloud CLI ecosystem is split between official Terraform CLI integration and community tools that expose Terraform Cloud API operations in the terminal. terraform-cloud by bendrucker is an early development interactive CLI focused on automating repetitive tasks in Terraform Cloud and complementing the Terraform Enterprise Provider. It provides migrate and open commands with options for hostname and modules directory, and is installed via Homebrew tap or binary download. Breaking changes will bump the 0.x version until version 1.0.0, and users should expect bugs.

tfccli by richclement provides a broader set of operations for Terraform Cloud in your terminal. It enables workspace listing, run creation and watching, state inspection, and variable configuration. Installation is available via Homebrew tap, Go install, or binary download, with an additional npx skills add path for AI agents.

Underlying all of these is the core Terraform CLI workflow. terraform init initializes a working directory, downloads provider plugins, initializes modules, and configures the backend where state files are stored. terraform plan shows what Terraform will change without modifying infrastructure, and terraform apply deploys the verified changes. terraform version reports the installed version. These commands work with declarative HCL configuration files to define infrastructure across providers such as Azure and AWS.

For Windows users targeting Azure, the established setup path involves installing Git Bash or Windows Terminal, installing Azure CLI, installing Terraform, and configuring the environment to run Terraform on Windows. Authentication options include Microsoft account authentication from Cloud Shell or Windows, and service principal creation via Azure CLI or PowerShell with credentials specified in environment variables or a Terraform provider block.

Choosing between terraform-cloud and tfccli depends on task focus. Use terraform-cloud for migration assistance and quick UI access to workspaces. Use tfccli for ongoing workspace management, run triggering, and state inspection from the command line. Both sit on top of the core Terraform CLI workflow that remains the foundation for initializing, planning, and applying infrastructure changes with Terraform Cloud as the remote backend.

Sources

  1. github.com/bendrucker/terraform-cloud-cli
  2. www.geeksforgeeks.org/devops/terraform-cheat-sheet/
  3. devtoolhub.com/terraform-cli-commands/
  4. tfccli.dev/
  5. learn.microsoft.com/en-us/azure/developer/terraform/get-started/get-started-windows-bash
  6. developer.hashicorp.com/terraform/cli/cloud

Related Posts