github_branch

This resource allows you to create and manage branches within your repository.

Additional constraints can be applied to ensure your branch is created from another branch or commit.

Example Usage

resource "github_branch" "development" {
  repository = "example"
  branch     = "development"
}

Argument Reference

The following arguments are supported:

Attribute Reference

The following additional attributes are exported:

Import

GitHub Branch can be imported using an ID made up of repository:branch, e.g.

$ terraform import github_branch.terraform terraform:main

Importing github branch into an instance object (when using a for each block to manage multiple branches)

$ terraform import github_branch.terraform["terraform"] terraform:main

Optionally, a source branch may be specified using an ID of repository:branch:source_branch. This is useful for importing branches that do not branch directly off main.

$ terraform import github_branch.terraform terraform:feature-branch:dev