Terraform on Azure

The Basics

When customers begin working with Azure they usually log into the portal and start to build things using the GUI.  After building their resources they notice they can download a template of their newly configured resource. Azure exports an ARM template that can be used to automate your next build.  Customers love the idea of automation and what that can do to help them leverage the cloud.

That’s a great starting point, then you start looking at ARM templates and realize that it is written in JSON. Okay, that adds in an element of learning.  Then when you deploy the ARM template you find that it fails, but why?  Essentially, you’re learning a new technology but there are some specific limiters in cloud adoption and skilling up.  Ideally though, this same person is managing an on-premises infrastructure and maybe other clouds.  They’ve hit a technical blocker.

Let me introduce Terraform, an open source tool created by Hashicorp that helps to remove the blockers that many encounters when adopting cloud technologies. 

In this series of articles, I am going to introduce Terraform and break down different components of how it works, in bite sized chunks.  Terraform is an open source product, so new features are constantly being added to its capability. 

As mentioned, Terraform is an open source tool created by Hashicorp that users HCL (Hashicorp Configuration Language), based on GO.  Essentially, it’s much much simpler to read and learn over JSON.  Which is instrumental in learning how to write scripts, especially for someone that may not have a developer’s background.  Terraform is a tool that you can use to deploy resources into your infrastructure using what they call providers.  You’re probably thinking, so what?  I can do that with the tools I have today: PowerShell, Ansible, CloudFormation, etc. 

Terraform doesn’t just deploy resources, it has the additional benefits:

  • Build resources, make changes and call existing resources
  • Scalability
  • Encourages collaboration
  • Enables governance
  • Reproducible
  • Enable CI/CD (Continuous Integration/Continuous Deployment)

This blog is going to walk you through various components of Terraform using a series of videos. I have documented the references that were made in the videos.  Follow the links to cover off each topic.  All of these videos focus on deploying to Azure.  In order to other environments/clouds, the same concepts can be used, re-writing the scripts to fit that provider (AWS, GCP, VMware, etc).

Let’s look at the first video covering off Terraform on Azure – the basics:

After you’ve watched the above video and are comfortable with the basics of Terraform, you can go into greater detail with the other topics below:

Terraform State File – Managing remote state for securing and scaling your deployments

Terraform Modules – Deploying re-usable code

Terraform and Azure DevOps – Delivering CI/CD deployments Link Coming Soon! In the meantime you can watch the video on Channel9

Terraform and Github Actions – Delivering code from your repoLink Coming Soon! In the meantime, you can watch the video on Channel9

4 thoughts on “Terraform on Azure”

  1. Hi April,
    Can you also compare Terraform with Powershell,Ansible, CloudFormation. ie like a Table format.
    So i can better know why i should go for Terraform.
    The bullet list you mentioned above is it only Applicable for Terraform alone?


    1. There’s a great blog written about this: https://blog.gruntwork.io/why-we-use-terraform-and-not-chef-puppet-ansible-saltstack-or-cloudformation-7989dad2865c

      It includes a graph but also explains. To be honest there is a lot to go over. Firstly, CloudFormation is AWS only, can’t use it in Azure nor with on-premises environments, so for me, that’s not an option when deploying to Azure. Ansible requires other components to run (agents, an environment to deploy from, etc) which can lead to blockers for a lot of my customers. Ansible is has its benefits for software deployments, there’s just a lot of overhead required to run Ansible that doesn’t always suit my customers. I LOVE PowerShell but it requires learning a skilling up and I tend to use it more for configuration and task automation. I see it more as a coding language to achieve something. PowerShell has to be deployed from a script without the benefits of things like modules, state management, etc.

      When looking at true IaC (Infrastructure as Code), ARM, CloudFormation, Terraform and Ansible are built for just that.


  2. Thanks for the response. I will check the other link. Need to try my hands at Terraform.
    Till now i used AzureDevops, but used the classic editor to pick the tasks.
    Terraform is the future for Azure?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s