Today we're pleased to announce HashiCorp Terraform Cloud and HashiCorp Terraform Enterprise support for Azure DevOps Services. This support includes the ability to link your Terraform Cloud and Enterprise workspaces to Azure DevOps-backed VCS repositories, and an upcoming open-source Azure Marketplace task for invoking Terraform operations. Included in this release is VCS-backed integration with workspaces and modules.

It’s always been our position that the best way to provision infrastructure is to store your infrastructure as code (IaC) configuration files in a VCS repository and use Terraform to create resources based on them. This process typically has three steps:
1. Write infrastructure as code
2. Manage configuration files in VCS
3. Automate infrastructure provisioning

Assuming you’re already familiar with creating Terraform configurations, we’ll focus on step 2. In this blog, we’ll discuss the following topics:
* How to set up your Azure DevOps Repositories
* Where you can find the Terraform task on the Azure Marketplace
* How to learn more at Microsoft Ignite

Setting up Azure DevOps Repositories

Setting up your Azure DevOps Repositories is as simple as configuring any other VCS repository type in Terraform Cloud. This newly supported repository type is available from within the Settings > VCS Providers view, simply by clicking Add VCS Provider and following a few simple instructions.

For complete details on how to add your repositories, you can reference our documentation — but for a simple overview, the steps are below.

  1. Make sure you already have a Terraform Enterprise or Cloud organization, and the rights to configure VCS providers.
  2. Make sure you also have both an Azure DevOps organization and an authentication application configured — complete instructions for this are in the Terraform documentation linked above.
  3. Click on Settings > VCS Providers, then Add VCS Provider.
  4. Select Azure DevOps Services from the dropdown list
  5. Fill in a few vital pieces of information, including your App ID and Client Secret, then click Create VCS Provider.
  6. Once the provider is created, copy your Callback URL and add it to your Azure DevOps authentication application
  7. Return to Terraform Cloud and click Connect Organization…
  8. Accept the following prompt, authorizing Terraform and Azure to communicate with each other, and that’s it!

You’re now ready to configure your Terraform Workspaces and Private Module Registry to take advantage of your new Azure DevOps connection. This will allow you to store your Terraform configurations and modules in your repositories — and get you one step closer to automated infrastructure provisioning.

Video walkthrough

In this video, you’ll walk through the process of configuring Azure DevOps Repositories from end to end and do some example provisioning actions

Finding and using the Terraform task on the Azure Marketplace

After configuring Azure DevOps as your VCS provider, the next step may be to integrate Terraform Cloud as a part of your standard CI/CD workflow. We’ve addressed capabilities from the Terraform side above, but what about invoking Terraform directly from ADO? Working with Microsoft, we’re going to be adding a Terraform extension to the Azure DevOps marketplace enabling users to invoke Terraform Cloud and Terraform Enterprise directly from Azure Pipelines. Features that will be supported include:

  • State configuration (azure blob or remote)
  • Terraform install (version selectable)
  • Terraform init
  • Terraform plan
  • Terraform apply
  • Terraform validate
  • Terraform fmt -check
  • Terraform plan -destroy
  • TFE connection setup
  • TFE create workspace
  • TFE configure variables
  • TFE configure workspace
  • TFE plan
  • TFE apply
  • TFE check run status
  • TFE destroy plan
  • TFE override
  • TFE delete workspace
  • Support for environment variables
  • Support for Input variables

To get started, access the Azure DevOps marketplace and search for the Terraform task published by Microsoft. Select the “Get it Free” button at the top of the page, sign in with your Azure or GitHub credentials, and add it to your existing organization. From there, you’ll be able to utilize Terraform as a part of your Pipeline build or release jobs.

Learn more at Microsoft Ignite

HashiCorp is a sponsor at Microsoft Ignite, happening Nov. 4-8, 2019 at the Orange County Convention Center in Orlando, FL. We will be located at booth #2013 on the expo floor. Experts will be available to answer questions about the Azure DevOps and Terraform integrations listed above, as well as any other product questions that you may have. For those attending the conference, there are a number of sessions happening throughout the week that explore using HashiCorp tools on Azure. Select the following links to learn more information about each session:

Getting started

Hopefully by now you’ve got a better understanding of how Azure DevOps and HashiCorp Terraform can combine to support your DevOps workflow. For more information on Terraform Cloud and Terraform Enterprise or to get started with your free trial, visit the Terraform product page. To learn more about Terraform visit the HashiCorp Learn platform and see it in action.

from Hashicorp Blog