To use Terraform you will need to install it. HashiCorp distributes Terraform as a binary package. You can also install Terraform using popular package managers.

Install Terraform

If you are using Cloud9, please follow instruction for Linux > Amazon Linux.

Homebrew is a free and open-source package management system for Mac OS X. Install the official Terraform formula from the terminal.

First, install the HashiCorp tap, a repository of all our Homebrew packages.

brew tap hashicorp/tap

Now, install Terraform with hashicorp/tap/terraform.

brew install hashicorp/tap/terraform

This installs a signed binary and is automatically updated with every new official release.

To update to the latest version of Terraform, first update Homebrew.

brew update

Then, run the upgrade command to download and use the latest Terraform version.

$ brew upgrade hashicorp/tap/terraform
==> Upgrading 1 outdated package:
hashicorp/tap/terraform 0.15.3 -> 1.0.0
==> Upgrading hashicorp/tap/terraform 0.15.3 -> 1.0.0

Chocolatey is a free and open-source package management system for Windows. Install the Terraform package from the command-line.

choco install terraform

Chocolatey and the Terraform package are NOT directly maintained by HashiCorp. The latest version of Terraform is always available by manual installation.

HashiCorp officially maintains and signs packages for the following Linux distributions.

Amazon Linux

Verify the installation

Verify that the installation worked by opening a new terminal session and listing Terraform’s available subcommands.

terraform -help
Usage: terraform [-version] [-help] <command> [args]

The available commands for execution are listed below.
The most common, useful commands are shown first, followed by
less common or more advanced commands. If you're just getting
started with Terraform, stick with the common commands. For the
other commands, please read the help and docs before usage.

Add any subcommand to terraform -help to learn more about what it does and available options.

terraform -help plan


If you get an error that terraform could not be found, your PATH environment variable was not set up properly. Please go back and ensure that your PATH variable contains the directory where Terraform was installed.

Enable tab completion

If you use either Bash or Zsh, you can enable tab completion for Terraform commands. To enable autocomplete, first ensure that a config file exists for your chosen shell.

touch ~/.bashrc
touch ~/.zshrc

Then install the autocomplete package.

terraform -install-autocomplete

Once the autocomplete support is installed, you will need to restart your shell.

Next Steps

Next, you will create a Terraform Cloud account, and configure Terraform Cloud for your AWS deployments.