{"id":60342,"date":"2020-11-24T14:53:16","date_gmt":"2020-11-24T22:53:16","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/devops\/?p=60342"},"modified":"2020-11-25T13:45:57","modified_gmt":"2020-11-25T21:45:57","slug":"arm-templates-or-hashicorp-terraform-what-should-i-use","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/arm-templates-or-hashicorp-terraform-what-should-i-use\/","title":{"rendered":"ARM Templates Or HashiCorp Terraform &#8211; What Should I Use?"},"content":{"rendered":"<p><a href=\"https:\/\/devblogs.microsoft.com\/devops\/what-is-infrastructure-as-code\/?WT.mc_id=devops-9648-zdeptawa\">Infrastructure as code<\/a> 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.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-infrastructure-as-code.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-infrastructure-as-code-300x150.png\" alt=\"Image blog infrastructure as code\" width=\"300\" height=\"150\" class=\"alignnone size-medium wp-image-60346\" srcset=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-infrastructure-as-code-300x150.png 300w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-infrastructure-as-code.png 600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>There are many tools that can help tackle infrastructure as code and they range from cloud-specific tools like <a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/?WT.mc_id=devops-9648-zdeptawa\">Azure Resource Manager Templates<\/a> to open-source cloud or host agnostic tools like <a href=\"https:\/\/azure.microsoft.com\/solutions\/devops\/terraform\/?WT.mc_id=devops-9648-zdeptawa\">HashiCorp Terraform<\/a>. Which is right for you?<\/p>\n<h2>What are you using now?<\/h2>\n<p>If you haven&#8217;t already looked into infrastructure as code, there is no better time than now. Infrastructure as code fits seamlessly into the <a href=\"https:\/\/docs.microsoft.com\/aspnet\/aspnet\/overview\/developing-apps-with-windows-azure\/building-real-world-cloud-apps-with-windows-azure\/continuous-integration-and-continuous-delivery#:~:text=Continuous%20integration%20%28CI%29%20means%20that%20whenever%20a%20developer,environment%20where%20you%20can%20do%20more%20in-depth%20testing.?WT.mc_id=devops-9648-zdeptawa\">CI\/CD (Continuous Integration\/Continuous Delivery)<\/a> portion of <a href=\"https:\/\/devblogs.microsoft.com\/devops\/what-is-devops-donovan\/?WT.mc_id=devops-9648-zdeptawa\">DevOps<\/a>. 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.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-devops-cycle.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-devops-cycle-300x172.png\" alt=\"Image blog devops cycle\" width=\"300\" height=\"172\" class=\"alignnone size-medium wp-image-60345\" srcset=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-devops-cycle-300x172.png 300w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-devops-cycle-768x440.png 768w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-devops-cycle.png 878w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>If you&#8217;re an <a href=\"https:\/\/azure.microsoft.com\/?WT.mc_id=devops-9648-zdeptawa\">Azure<\/a> customer, it&#8217;s likely you&#8217;ve already heard of or have looked at <a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/?WT.mc_id=devops-9648-zdeptawa\">ARM Templates<\/a> for automating some piece of your infrastructure. If you&#8217;re not an Azure customer, you may have looked at similar offerings that are specific to your cloud hosting provider. Offerings like <a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/?WT.mc_id=devops-9648-zdeptawa\">ARM Templates<\/a> or cloud-specific infrastructure as code tools work to deploy and manage infrastructure exclusively on the cloud hosting provider they were built for.<\/p>\n<p>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 &#8211; and each cloud provider&#8217;s tooling will use different syntax and verbiage. This is where cloud or host agnostic tools like <a href=\"https:\/\/azure.microsoft.com\/solutions\/devops\/terraform\/?WT.mc_id=devops-9648-zdeptawa\">HashiCorp Terraform<\/a> can really make life easier working across clouds as well as on-premises environments.<\/p>\n<h2>ARM Templates vs HashiCorp Terraform<\/h2>\n<p>Infrastructure as code at its very heart is declaring what services or infrastructure you want by means of code &#8211; much in the same way a developer writes code for an application.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-azure-logo.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-azure-logo-300x99.png\" alt=\"Image blog azure logo\" width=\"300\" height=\"99\" class=\"alignnone size-medium wp-image-60344\" srcset=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-azure-logo-300x99.png 300w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-azure-logo-1024x339.png 1024w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-azure-logo-768x254.png 768w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-azure-logo-1536x508.png 1536w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-azure-logo-2048x677.png 2048w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>ARM stands for Azure Resource Manager, and an <a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/?WT.mc_id=devops-9648-zdeptawa\">ARM Template<\/a> allows you to define resources that you&#8217;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&#8217;d prefer to not manage all resources via that template.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-hashicorp-terraform-logo.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-hashicorp-terraform-logo-300x78.png\" alt=\"Image blog hashicorp terraform logo\" width=\"300\" height=\"78\" class=\"alignnone size-medium wp-image-60350\" srcset=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-hashicorp-terraform-logo-300x78.png 300w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-hashicorp-terraform-logo-1024x266.png 1024w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-hashicorp-terraform-logo-768x200.png 768w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-hashicorp-terraform-logo-1536x400.png 1536w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-hashicorp-terraform-logo.png 1714w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/azure.microsoft.com\/solutions\/devops\/terraform\/?WT.mc_id=devops-9648-zdeptawa\">HashiCorp Terraform<\/a> 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 <a href=\"https:\/\/www.terraform.io\/docs\/configuration\/syntax.html\">HCL (HashiCorp Configuration Language)<\/a> 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.<\/p>\n<h2>Deploying ARM Templates with Terraform<\/h2>\n<p>Both <a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/?WT.mc_id=devops-9648-zdeptawa\">ARM Templates<\/a> and <a href=\"https:\/\/azure.microsoft.com\/solutions\/devops\/terraform\/?WT.mc_id=devops-9648-zdeptawa\">HashiCorp Terraform<\/a> are solid choices, but what if you&#8217;re already using <a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/?WT.mc_id=devops-9648-zdeptawa\">ARM Templates<\/a> and you&#8217;d like to give <a href=\"https:\/\/azure.microsoft.com\/solutions\/devops\/terraform\/?WT.mc_id=devops-9648-zdeptawa\">Terraform<\/a> a try? This is a very common scenario as teams work to diversify their cloud across several providers. If you already have <a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/?WT.mc_id=devops-9648-zdeptawa\">ARM Templates<\/a>, the rework to translate those into Terraform configuration files could be a frustrating time sink &#8211; but luckily, there is a solution!<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-tf-arm-template.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-tf-arm-template-300x228.png\" alt=\"Image blog tf arm template\" width=\"300\" height=\"228\" class=\"alignnone size-medium wp-image-60348\" srcset=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-tf-arm-template-300x228.png 300w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-tf-arm-template-1024x779.png 1024w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-tf-arm-template-768x584.png 768w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-tf-arm-template-1536x1169.png 1536w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-tf-arm-template.png 1766w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/azure.microsoft.com\/solutions\/devops\/terraform\/?WT.mc_id=devops-9648-zdeptawa\">HashiCorp Terraform<\/a> has a resource called <code>azurerm_resource_group_template_deployment<\/code> for the AzureRM provider. This resource allows you to deploy an <a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/?WT.mc_id=devops-9648-zdeptawa\">ARM Template<\/a> through <a href=\"https:\/\/azure.microsoft.com\/solutions\/devops\/terraform\/?WT.mc_id=devops-9648-zdeptawa\">HashiCorp Terraform<\/a>. This means you can use the same <a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/?WT.mc_id=devops-9648-zdeptawa\">ARM Template<\/a> code within your <a href=\"https:\/\/azure.microsoft.com\/solutions\/devops\/terraform\/?WT.mc_id=devops-9648-zdeptawa\">HashiCorp Terraform<\/a> configuration file without the need to translate the <a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/?WT.mc_id=devops-9648-zdeptawa\">ARM Template<\/a> into the various Terraform AzureRM resources that would be required to move from <a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/?WT.mc_id=devops-9648-zdeptawa\">ARM templates<\/a> to <a href=\"https:\/\/azure.microsoft.com\/solutions\/devops\/terraform\/?WT.mc_id=devops-9648-zdeptawa\">Terraform<\/a>.<\/p>\n<h2>Azure DevOps Provider<\/h2>\n<p>Does your team use <a href=\"https:\/\/devops.azure.com\/?WT.mc_id=devops-9648-zdeptawa\">Azure DevOps<\/a>? No worries &#8211; <a href=\"https:\/\/azure.microsoft.com\/solutions\/devops\/terraform\/?WT.mc_id=devops-9648-zdeptawa\">Terraform<\/a> also has an Azure DevOps Provider. This means you can use <a href=\"https:\/\/azure.microsoft.com\/solutions\/devops\/terraform\/?WT.mc_id=devops-9648-zdeptawa\">HashiCorp Terraform<\/a> to manage your <a href=\"https:\/\/devops.azure.com\/?WT.mc_id=devops-9648-zdeptawa\">Azure DevOps<\/a> Projects as well. \ud83d\ude42<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-tf-azure-devops-300x127.png\" alt=\"Image blog tf azure devops\" width=\"300\" height=\"127\" class=\"alignnone size-medium wp-image-60349\" srcset=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-tf-azure-devops-300x127.png 300w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-tf-azure-devops-768x326.png 768w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-tf-azure-devops.png 866w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h2>Next Steps<\/h2>\n<p>If you haven&#8217;t already tried any infrastructure as code offerings, spend some time checking them out! You can leverage <a href=\"https:\/\/azure.microsoft.com\/free\/?WT.mc_id=devops-9648-zdeptawa\">Microsoft Azure&#8217;s free tier<\/a> for testing. Be sure to check out the <a href=\"https:\/\/docs.microsoft.com\/en-us\/learn\/paths\/deploy-manage-resource-manager-templates\/?WT.mc_id=devops-9648-zdeptawa\">Deploy and manage resources in Azure by using ARM templates Learning Path<\/a> on <a href=\"https:\/\/docs.microsoft.com\/learn\/?WT.mc_id=devops-9648-zdeptawa\">Microsoft Learn<\/a>. This learning path will walk you through getting started using ARM Templates via the <a href=\"https:\/\/docs.microsoft.com\/cli\/azure\/what-is-azure-cli?WT.mc_id=devops-9648-zdeptawa\">Azure CLI<\/a>, <a href=\"https:\/\/docs.microsoft.com\/powershell\/azure\/?WT.mc_id=devops-9648-zdeptawa\">Azure PowerShell<\/a>, and <a href=\"https:\/\/docs.microsoft.com\/azure\/developer\/github\/github-actions?WT.mc_id=devops-9648-zdeptawa\">GitHub Actions<\/a>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-learning-path.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-learning-path-300x178.png\" alt=\"Image blog learning path\" width=\"300\" height=\"178\" class=\"alignnone size-medium wp-image-60366\" srcset=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-learning-path-300x178.png 300w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-learning-path-1024x606.png 1024w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-learning-path-768x455.png 768w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-learning-path-1536x910.png 1536w, https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2020\/11\/blog-learning-path.png 1790w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>For even more information, check out these useful links related to this article:<\/p>\n<p><a href=\"https:\/\/azure.microsoft.com\/free\/?WT.mc_id=devops-9648-zdeptawa\">Sign Up for Free Microsoft Azure Account<\/a><\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/overview?WT.mc_id=devops-9648-zdeptawa\">Getting Started with ARM Templates<\/a><\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/add-template-to-azure-pipelines?WT.mc_id=devops-9648-zdeptawa\">Integrate ARM templates with Azure Pipelines<\/a><\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/azure\/azure-resource-manager\/templates\/?WT.mc_id=devops-9648-zdeptawa\">ARM Template Documentation<\/a><\/p>\n<p><a href=\"https:\/\/azure.microsoft.com\/resources\/templates\/?WT.mc_id=devops-9648-zdeptawa\">ARM QuickStart Templates<\/a><\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/azure\/developer\/terraform\/?WT.mc_id=devops-9648-zdeptawa\">Terraform Documentation<\/a><\/p>\n<p><a href=\"https:\/\/azure.microsoft.com\/solutions\/devops\/terraform\/?WT.mc_id=devops-9648-zdeptawa\">HashiCorp Terraform on Azure<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are many tools that can help tackle infrastructure as code including cloud or host agnostic options like HashiCorp Terraform as well as platform-specific options like Azure Resource Manager Templates. Which is right for you?<\/p>\n","protected":false},"author":39342,"featured_media":60352,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[224,1],"tags":[],"class_list":["post-60342","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","category-devops"],"acf":[],"blog_post_summary":"<p>There are many tools that can help tackle infrastructure as code including cloud or host agnostic options like HashiCorp Terraform as well as platform-specific options like Azure Resource Manager Templates. Which is right for you?<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/60342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/39342"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=60342"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/60342\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/60352"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=60342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=60342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=60342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}