Mantra Networking Mantra Networking

Setup Azure Cloud Shell Environment for Terraform Development

Setup Azure Cloud Shell Environment for Terraform Development

Login with your Azure Credentials

  1. Open the Azure Portal in your web browser.
  2. Click on the Cloud Shell icon in the top right corner of the portal.
  3. If prompted, click "Bash" to launch the Azure Cloud Shell.
  4. The first time you launch the Cloud Shell, you will be asked to create a storage account and file share. Follow the prompts to complete this setup.

Create Storage for Azure Cloud Shell

  1. If you haven't already, click on the "Create storage" button when prompted in the Cloud Shell.
  2. Select the Azure subscription you want to use.
  3. Choose the region where you want to create the storage resources.
  4. The Cloud Shell will automatically create a new resource group, storage account, and file share for you.

Verify Terraform is Installed

  1. Within the Azure Cloud Shell, run the command terraform version.
  2. This should output the version of Terraform that is pre-installed in the Cloud Shell environment.

Start using Terraform in the Azure Cloud Shell

  1. Create a new directory for your Terraform project: mkdir terraform-project && cd terraform-project.
  2. Initialize a new Terraform working directory: terraform init.
  3. Start building your Terraform configuration files, such as main.tfvariables.tf, and outputs.tf.
  4. Run terraform plan to preview the changes your configuration will make.
  5. If the plan looks good, run terraform apply to provision the resources in Azure.
  6. When you're done, you can run terraform destroy to remove the resources.

Read next

Terraform: Backend

Terraform: Backend

Table of Contents * Overview * Backend Configuration * Example: S3 Backend Block * Example: Remote Backend (Terraform Cloud) * Backend Configuration Files * Credentials * State Management Recommendations * Commands and Workflow

Lauren Garcia • • 13 min read
Terraform: Outputs

Terraform: Outputs

Table of Contents * Overview * Purpose * Location & Best Practices * Output Declaration Example * Sample Output as Rendered * Accessing Output Values * Example: Output Usage in Module Composition

Lauren Garcia • • 9 min read
Terraform: Variables

Terraform: Variables

Table of Contents * Overview * Declaring Variables * Variable Attributes and Options * Variable Types * Supplying Variable Values * Accessing Variable Values * Best Practices * Conclusion Terraform Variables: Overview What

Lauren Garcia • • 8 min read