ARM Templates Or HashiCorp Terraform – What Should I Use?

Zachary Deptawa

Infrastructure as code has transformed the way we build and manage our applications, and cloud hosting has paved the way by giving us the power to spin up and tear down entire environments nearly instantly with only a few keystrokes at the command line.

Image blog infrastructure as code

There are many tools that can help tackle infrastructure as code and they range from cloud-specific tools like Azure Resource Manager Templates to open-source cloud or host agnostic tools like HashiCorp Terraform. Which is right for you?

What are you using now?

If you haven’t already looked into infrastructure as code, there is no better time than now. Infrastructure as code fits seamlessly into the CI/CD (Continuous Integration/Continuous Delivery) portion of DevOps. Leveraging infrastructure as code gives your operations and engineering teams the ability to adopt DevOps best practices by allowing them to focus on reliably and consistently delivering value to your end-users.

Image blog devops cycle

If you’re an Azure customer, it’s likely you’ve already heard of or have looked at ARM Templates for automating some piece of your infrastructure. If you’re not an Azure customer, you may have looked at similar offerings that are specific to your cloud hosting provider. Offerings like ARM Templates or cloud-specific infrastructure as code tools work to deploy and manage infrastructure exclusively on the cloud hosting provider they were built for.

If you want to have your infrastructure span several cloud providers or platforms using these tools alone, you will need to work with each tool from each provider – and each cloud provider’s tooling will use different syntax and verbiage. This is where cloud or host agnostic tools like HashiCorp Terraform can really make life easier working across clouds as well as on-premises environments.

ARM Templates vs HashiCorp Terraform

Infrastructure as code at its very heart is declaring what services or infrastructure you want by means of code – much in the same way a developer writes code for an application.

Image blog azure logo

ARM stands for Azure Resource Manager, and an ARM Template allows you to define resources that you’d like to stand up or manage within Azure. You can use an ARM template to manage all resources from an entire Resource Group, or you can manage one or more resources within a Resource Group if you’d prefer to not manage all resources via that template.

Image blog hashicorp terraform logo

HashiCorp Terraform is an open-source tool that uses a provider and resource model to manage infrastructure as code. In this way, you can manage resources from any number of providers (such as cloud providers) within the same codebase. This is where Terraform really shines. No matter the provider, all HashiCorp Terraform configuration files use HCL (HashiCorp Configuration Language) syntax to define resources. This means the syntax for environments that span several different providers will be the same, and the process to deploy or make changes with that code is identical as well.

Deploying ARM Templates with Terraform

Both ARM Templates and HashiCorp Terraform are solid choices, but what if you’re already using ARM Templates and you’d like to give Terraform a try? This is a very common scenario as teams work to diversify their cloud across several providers. If you already have ARM Templates, the rework to translate those into Terraform configuration files could be a frustrating time sink – but luckily, there is a solution!

Image blog tf arm template

HashiCorp Terraform has a resource called azurerm_resource_group_template_deployment for the AzureRM provider. This resource allows you to deploy an ARM Template through HashiCorp Terraform. This means you can use the same ARM Template code within your HashiCorp Terraform configuration file without the need to translate the ARM Template into the various Terraform AzureRM resources that would be required to move from ARM templates to Terraform.

Azure DevOps Provider

Does your team use Azure DevOps? No worries – Terraform also has an Azure DevOps Provider. This means you can use HashiCorp Terraform to manage your Azure DevOps Projects as well. 🙂

Image blog tf azure devops

Next Steps

If you haven’t already tried any infrastructure as code offerings, spend some time checking them out! You can leverage Microsoft Azure’s free tier for testing. Be sure to check out the Deploy and manage resources in Azure by using ARM templates Learning Path on Microsoft Learn. This learning path will walk you through getting started using ARM Templates via the Azure CLI, Azure PowerShell, and GitHub Actions.

Image blog learning path

For even more information, check out these useful links related to this article:

Sign Up for Free Microsoft Azure Account

Getting Started with ARM Templates

Integrate ARM templates with Azure Pipelines

ARM Template Documentation

ARM QuickStart Templates

Terraform Documentation

HashiCorp Terraform on Azure


Discussion is closed.

Feedback usabilla icon