Skip to content

Dr. Praveen Borra

  • About
  • Expertise
  • Work
  • Research
  • Media
  • Blog
  • Contact
September 23, 2020

·

2–3 minutes

Terraform using Azure Cloud Shell

By Dr. Praveen Borra

Terraform with Azure:
Hashicorp Terraform is an open-source tool for provisioning and managing cloud infrastructure. It codifies infrastructure in configuration files that describe the topology of cloud resources. These resources include virtual machines, storage accounts, and networking interfaces. The Terraform CLI provides a simple mechanism to deploy and version the configuration files to Azure.

Automate infrastructure management:

Terraform’s template-based configuration files enable you to define, provision, and configure Azure resources in a repeatable and predictable manner. Automating infrastructure has several benefits:

  • Lowers the potential for human errors while deploying and managing infrastructure.
  • Deploys the same template multiple times to create identical development, test, and production environments.
  • Reduces the cost of development and test environments by creating them on-demand.

Understand infrastructure changes before being applied:

As a resource topology becomes complex, understanding the meaning and impact of infrastructure changes can be difficult.

The Terraform CLI enables users to validate and preview infrastructure changes before application. Previewing infrastructure changes in a safe manner has several benefits:

  • Team members can collaborate more effectively by quickly understanding proposed changes and their impact.
  • Unintended changes can be caught early in the development process

Getting started with Terraform using Azure Cloud Shell:

Terraform enables the definition, preview, and deployment of cloud infrastructure. Using Terraform, you create configuration files using HCL syntax. The HCL syntax allows you to specify the cloud provider – such as Azure – and the elements that make up your cloud infrastructure. After you create your configuration files, you create an execution plan that allows you to preview your infrastructure changes before they’re deployed. Once you verify the changes, you apply the execution plan to deploy the infrastructure.

Create a Terraform configuration file:

1. Create a directory to hold the Terraform files

mkdir QuickstartTerraformTest

2. Change directories to the demo directory.

cd QuickstartTerraformTest

3. Using your favorite editor, create a Terraform configuration file.

code QuickstartTerraformTest.tf

4. Paste the following HCL into the new file.

provider “azurerm” {

# The “feature” block is required for AzureRM provider 2.x.

# If you are using version 1.x, the “features” block is not allowed.

version = “~>2.0”

features {} }

resource “azurerm_resource_group” “rg” {

 name = “QuickstartTerraformTest-rg”

location = “eastus”

}

Delete the resources:

1. Run the terraform destroy that will reverse the current execution plan.

terraform destroy

2. Terraform shows you what will happen if you reverse the execution plan and requires you to confirm. Confirm by entering yes and pressing the Enter key.

3. Once you confirm the execution of the play, the output is similar to the following example, verify that the resource group was deleted by using 

az group show

az group show -n “QuickstartTerraformTest-rg”


Share this:

  • Share on X (Opens in new window) X
  • Share on Facebook (Opens in new window) Facebook
Like Loading…

Dr. Praveen Borra

Principal Data & AI Architect for Microsoft Fabric and Azure, with a Ph.D. in Computer Science from Florida Atlantic University. I write about cloud, data and AI.

About me · Services · Get in touch

Leave a Reply Cancel reply

Keep reading

Latest articles

  • July 5, 2024

    Edge Computing: Applications Across Industries and Future Innovations

    Introduction In today’s digital landscape, where data generation and consumption are at an all-time high, traditional methods of data processing face significant…

  • July 13, 2022

    Azure SQL Edge

    What is Azure SQL Edge? Azure SQL Edge is an optimized relational database engine geared for IoT and IoT Edge deployments. It…

  • July 13, 2022

    Microsoft Purview

    What’s available in the Microsoft Purview governance portal? Microsoft Purview’s solutions in the governance portal provide a unified data governance service that…

All articles →

Dr. Praveen Borra

Enterprise data and AI leader on Microsoft Fabric and Azure. Ph.D. in Computer Science, Florida Atlantic University.

Dallas, Texas

Get in touch →

Explore

About

Services

Work

Research

Teaching

Media

Blog

Connect

Contact

LinkedIn

YouTube

Google Scholar

All profiles

© 2026 Dr. Praveen Borra

Views expressed on this site are my own.

  • Comment
  • Reblog
  • Subscribe Subscribed
    Dr. Praveen Borra

    Have a WordPress.com account? Log in now.

  • Dr. Praveen Borra
    Copy shortlinkView post in Reader
    Manage subscriptionsSign upLog in
    Report this content
    Collapse this bar
%d