Integrating Terraform with Azure Cloud Shell

If we are using Terraform to deploy an infrastructure in Azure, we should also know that the Azure team has integrated Terraform into Azure Cloud Shell.


To learn more about Azure Cloud Shell, refer to its documentation:  https://azure.microsoft.com/en-us/features/cloud-shell/.

To use it from the Azure Cloud Shell, follow these steps:

  1. Connect to the Azure portal by opening the URL, https://portal.azure.com, and sign in with your Azure account:
  1. Open the Cloud Shell and choose the mode we want, that is, Bash or PowerShell.
  2. Then, we can run the Terraform command line in the shell.

The following is a screenshot of the execution of Terraform in Azure Cloud Shell:

The advantage of using this solution is that we don't need any software to install; we can upload your Terraform files to Cloud Shell and run them in it. Additionally, we are already connected to Azure so no configuration is required (refer to the following section, Configuring Terraform for Azure).  

However, this solution is only to be used in development mode and not for local or automatic use of Terraform. It is for this reason, in this chapter, we will discuss the configuration of Terraform for Azure.

Now that we have installed Terraform, we can now start using it locally to provision an Azure infrastructure starting with the first step, which is to configure Terraform for Azure.