On behalf of HashiCorp and Microsoft, I am excited to announce the release of Azure DevOps Provider 0.0.1 for Terraform. With this provider, you will be able to manage Azure DevOps resources like projects, CI/CD pipelines, and build policies through Terraform.

Many of our customers have been moving towards Infrastructure as Code (IaC) tools such as Terraform to standardize the deployment of cloud infrastructure. This strategy has many advantages over manual configuration, such as improved auditability through source control, repeatability, and consistency through automated processes and the ability to establish robust, re-usable patterns with IaC modules. In addition to adopting IaC, many customers have automated deployments for their applications and need a repeatable and consistent way to provision resources—hence setting up a need for the Azure DevOps Provider in Terraform.

While staying true to our goal of improving the experience of managing Microsoft Azure with Terraform, we sought to make configurations for Azure DevOps resources—like service connections, pipelines, and git repositories—simpler by enabling management through Terraform via this new provider.

What is Azure DevOps?

For those who aren’t familiar with Azure DevOps, in the simplest terms, Azure DevOps provides end-to-end solutions on Azure. Throughout the application lifecycle phases of planning, developing, delivering, and operating, teams can implement DevOps practices. These DevOps technologies, combined with people and processes, enable teams to continually provide value to customers.

Using the Azure DevOps Provider for Terraform, you can model and manage the DevOps for your project. This means that the description of Azure DevOps repositories, service connections, pipelines, variable groups, groups, group memberships, and many others can be committed as source code and managed through Terraform in a consistent and repeatable way.

Here is what some of our customers have to say about the provider:

“The Azure DevOps Provider for Terraform has enabled us to utilize our existing infrastructure automation tools and processes to decrease the time to provision Azure DevOps projects for our developers. This in turn has saved us time & money, increasing developer satisfaction.”

-Matthias Eberle, Head of Cloud Operations, Union Investment

“The Azure DevOps Provider for Terraform has helped support our “cattle not pets” infrastructure. We can now provision Azure DevOps projects with Service Connections that update with the infrastructure they connect to!”

-Connor Brown, Senior Cloud Engineer, 84.51° LLC

Example of using the Azure DevOps Provider

The Azure DevOps Provider for Terraform has a lot of features, but here is a simple example that shows how easy it can be to create a new Azure DevOps project, repository and build definition in a repeatable way with Terraform:

resource "azuredevops_project" "p" {
  project_name = "Sample Project"
}
 
resource "azuredevops_variable_group" "vars" {
  project_id   = azuredevops_project.p.id
  name         = "Sample Variable Group"
  description  = "Managed by Terraform"
  allow_access = true
 
  variable {
    name  = "FOO"
    value = "BAR"
  }
  variable {
    name      = "FOO_SECRET"
    value     = "drop"
    is_secret = true
  }
}
 
resource "azuredevops_git_repository" "repo" {
  project_id = azuredevops_project.p.id
  name       = "Sample Repository"
  initialization {
    init_type = "Clean"
  }
}
 
resource "azuredevops_build_definition" "build" {
  project_id = azuredevops_project.p.id
  name       = "Sample Pipeline"
 
  repository {
    repo_type   = "TfsGit"
    repo_name   = azuredevops_git_repository.repo.name
    branch_name = azuredevops_git_repository.repo.default_branch
    yml_path    = "azure-pipelines.yml"
  }
 
  variable_groups = [azuredevops_variable_group.vars.id]
}

For the full list of features, check out the Azure DevOps Provider for Terraform on the HashiCorp site. We hope you are as excited about the new provider as we are. If you have any feedback, please let us know on GitHub.