Automation Tutorial: Create Azure Resource with Terraform

Automation Tutorial: Create Azure Resource with Terraform

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

terraforn-init

3. Creating Terraform Plan

terraforn-plan

4. Terraform Apply / Run

terraforn-apply

5. Azure Portal : Resource Group

az-rsg

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 terraform apply
  4. We have Azure Resource Group automatically via Teraaform.

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


Share Tweet Send
0 Comments
Loading...