Manage Azure DevOps organization with Terraform 2/3: Manage projects

In the first part of this article series about my Azure DevOps Terraform provider, we see:

  • The download and installation of the Azure DevOps provider
  • The configuration of the provider in Terraform

In this article I will explain how use the provider for manage projects in Azure DevOps Organization.

The azuredevops_project resource

For manage project, add azuredevops_project resource block in your Terraform code with this configuration:

Minimum configuration:

provider "azuredevops" {}
resource "azuredevops_project" "project" {
     name                = "project name"
}

The only required parameter is the name of the project.

You can also add more parameters with this configuration:

provider "azuredevops" {}
resource "azuredevops_project" "project" {
       name                = "project name"
       description         = "my project terraform"
       template_type_name  = "agile"
       source_control_type = "Git"
       visibility          = "private"
}
  • The name is the project name
  • The description is the description of the project
  • The template_type_name is the name of the process. if not provided , the resource use the default process template configured in your Organization settings
  • The source_control_type is the type of SCM , (Git or TFVC), if not provided the default value is Git
  • The visibility of the project : private or public, if not provided the default value is private.
Azure DevOps Terraform provider, create project

Updating a project

For update a project, the behavior of the provider is exactly the same as the UI: the only information that it’s possible to update are the name, the description and the visibility of the project.
If the template type or the source control type are changed, the provider return an error.

Exported attributes as output

The resource azuredevops_project return the id and the name of the created project.

And the result, after creating a project

These exported properties can be used as inputs for other resources.

That’all for the Azure DevOps project management with Terraform. It the next article, we will see how manage Build definition with this Azure DevOps Terraform provider.

Resources: