Skip to content

Latest commit

 

History

History
80 lines (56 loc) · 2.61 KB

File metadata and controls

80 lines (56 loc) · 2.61 KB
layout page_title description
azuredevops
AzureDevops: azuredevops_git_repository_branch
Manages a Git Repository Branch.

azuredevops_git_repository_branch

Manages a Git Repository Branch.

Example Usage

resource "azuredevops_project" "example" {
  name               = "Example Project"
  visibility         = "private"
  version_control    = "Git"
  work_item_template = "Agile"
}

resource "azuredevops_git_repository" "example" {
  project_id = azuredevops_project.example.id
  name       = "Example Git Repository"
  initialization {
    init_type = "Clean"
  }
}

resource "azuredevops_git_repository_branch" "example" {
  repository_id = azuredevops_git_repository.example.id
  name          = "example-branch-name"
  ref_branch    = azuredevops_git_repository.example.default_branch
}

resource "azuredevops_git_repository_branch" "example_from_commit_id" {
  repository_id = azuredevops_git_repository.example.id
  name          = "example-from-commit-id"
  ref_commit_id = azuredevops_git_repository_branch.example.last_commit_id
}

Arguments Reference

The following arguments are supported:

  • name - (Required) The name of the branch in short format not prefixed with refs/heads/.

  • repository_id - (Required) The ID of the repository the branch is created against.


  • ref_branch - (Optional) The reference to the source branch to create the branch from, in <name> or refs/heads/<name> format. Conflict with ref_tag, ref_commit_id.

  • ref_tag - (Optional) The reference to the tag to create the branch from, in <name> or refs/tags/<name> format. Conflict with ref_branch, ref_commit_id.

  • ref_commit_id - (Optional) The commit object ID to create the branch from. Conflict with ref_branch, ref_tag.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Git Repository Branch, in the format <repository_id>:<name>.
  • last_commit_id - The commit object ID of last commit on the branch.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 10 minutes) Used when creating the Git Branch.
  • read - (Defaults to 5 minute) Used when retrieving the Git Branch.
  • delete - (Defaults to 10 minutes) Used when deleting the Git Branch.

Import

Azure DevOps Git Repository Branch can be imported using the repository ID:branchName.

terraform import azuredevops_git_repository_branch.example "00000000-0000-0000-0000-000000000000:main"