There are two quick-start options for the Azure user:
- HashiCorp Terraform is installed by default in the Azure Cloud Shell. Cloud shell can be run standalone, or as an integrated command-line terminal from the Azure portal.
- Microsoft publishes a Terraform solution template for Microsoft Azure. The template will create a Linux virtual machine with Terraform installed, along with tools configured to work with Azure. If you are using an Azure free account, change the default instance size to one that is available on the free tier, such as
We recommend that you use Cloud Shell and the Azure portal to complete this tutorial because it is the easiest way to get started using Terraform on Azure. The first step for most other systems is to install Terraform.
To install Terraform on any supported system:
- Find the appropriate Terraform distribution package for your system and download it. Terraform is distributed as a single
- After downloading Terraform, unzip the package to a directory of your choosing. Terraform runs as a single binary named
terraform. Any other files in the package can be safely removed and Terraform will still function.
- Optional but recommended: modify the path to include the directory that contains the Terraform binary.
» Compile from source
If you want to be certain that the
terraform binary is from a trusted source, you can compile it yourself. This guide will not cover how to compile Terraform from source. The Terraform core and instructions are available from HashiCorp's GitHub repository.
» Verifying the installation
After installing Terraform, verify the installation by opening a new
terminal session and checking that Terraform is available. Execute
terraform at the prompt, and you should see output similar to this (truncated here for brevity):
glenn@Azure:~$ terraform 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. Common commands: apply Builds or changes infrastructure console Interactive console for Terraform interpolations destroy Destroy Terraform-managed infrastructure ...
If you get an error that
terraform could not be found, your
variable was not set up properly. Please go back and ensure that your
variable contains the directory where Terraform was installed.