| layout | page_title | description |
|---|---|---|
azuredevops |
AzureDevops: azuredevops_git_repository_branch |
Manages a Git Repository Branch. |
Manages a Git Repository Branch.
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
}The following arguments are supported:
-
name- (Required) The name of the branch in short format not prefixed withrefs/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>orrefs/heads/<name>format. Conflict withref_tag,ref_commit_id. -
ref_tag- (Optional) The reference to the tag to create the branch from, in<name>orrefs/tags/<name>format. Conflict withref_branch,ref_commit_id. -
ref_commit_id- (Optional) The commit object ID to create the branch from. Conflict withref_branch,ref_tag.
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.
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.
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"