Create Azure Resource with Terraform

Najib Radzuan
devops4me
Published in
2 min readNov 14, 2020

--

This tutorial will show you on how to create a Azure Resource Group by using the popular Terraform tool.

What is Terraform?

For those who may not be familiar with Terraform, it is a method that modifies the configuration of cloud resources. The tools are stuff that you like, such as providing Resource group on Azure Cloud, AWS Cloud, Google Cloud, etc. In order to explain our desired infrastructure, Terraform Scripts themselves use a declarative human readable. The Terraform method is used to incorporate the changes in the script. This whole process is called infrastructure as code (#IaC), with scripts managed by git or by another version source code system.

Prerequisite

  1. Azure Account( https://azure.microsoft.com/en-us/features/azure-portal/)
  2. Install Azure CLI ( https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
  3. Azure Login ( az login)
  4. Terraform ( v 12 )

1. Create a base Terraform configuration file

2. Initializing Terraform

3. Creating Terraform Plan

4. Terraform Apply / Run

5. Azure Portal : Resource Group

Recap / Summary

We had learned how to use Terraform to provision Azure Resource Group by following steps;

  1. Create Terraform Configuration file(provider.tf)
  2. Set our Terraform Plan
  3. To run our Terraform Plan we can apply to terraform apply
  4. We have Azure Resource Group automatically via Terraform.

Next, you can explore many Azure resource provisions with Terraform such to provision Azure App Service, Azure VM, Azure Function and etc.

--

--

Najib Radzuan
devops4me

DevOps | DevSecOps | Global DevOps Ambassador | CDF Ambassador | Digital Transformation [https://linktr.ee/devops4me]