In order to use Terraform in Azure Cloud Shell, perform the following steps:
- In the Azure portal, open Azure Cloud Shell by clicking the Cloud Shell button in the top menu, as shown in the following screenshot:
- Inside the Cloud Shell panel, in the top menu, in the dropdown, choose Bash mode:
- In the Cloud Shell terminal, create a new folder, demotf, inside the default clouddrive folder by executing the following command:
mkdir clouddrive/demotf
Inside this new folder, enter the cd clouddrive/demotf command.
- To write a Terraform configuration inside an integrated Visual Studio Code instance, execute the code command.
- In the editor, in the opened blank page, write the Terraform configuration with the following sample code:
terraform {
required_version = ">= 0.12"
}
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "rg-app" {
name = "RG-TEST-DEMO"
location...