Resource that allows to declare branch protection rules for repository.
| Name | Version |
|---|---|
| terraform | >= 0.13 |
| github | < 5.0 |
| Name | Version |
|---|---|
| github | < 5.0 |
| Name | Type |
|---|---|
| github_branch_protection.develop | resource |
| github_branch_protection.main | resource |
| github_branch_protection.master | resource |
| github_branch_protection.stage | resource |
| github_branch_protection.staging | resource |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| repository_name | GitHub repository name | string |
n/a | yes |
| develop_context | The list of status checks to require in order to merge into develop. Default: no checks. | list(string) |
[] |
no |
| stage_context | The list of status checks to require in order to merge into stage. Default: no checks. | list(string) |
[] |
no |
| master_context | The list of status checks to require in order to merge into master. Default: no checks. | list(string) |
[] |
no |
| main_context | The list of status checks to require in order to merge into main. Default: no checks. | list(string) |
[] |
no |
| use_develop | Indicate the existence of a develop branch. | bool |
false |
no |
| use_stage | Indicate the existence of a stage branch. | bool |
false |
no |
| use_master | Indicate the existence of a master branch. | bool |
false |
no |
| use_main | Indicate the existence of a main branch. | bool |
true |
no |
module "some-project-branch-protection" {
source = "[email protected]:masterborn/terraform-github-default-branch-protection.git?ref=v1.1.0"
repository_name = module.some-project.repository_name
use_develop = true
use_stage = true
use_master = true
}This will create only main branch:
module "some-project-branch-protection" {
source = "[email protected]:masterborn/terraform-github-default-branch-protection.git?ref=v1.1.0"
repository_name = module.some-project.repository_name
}Following pre-commit hooks are provided:
- terraform-fmt to check syntax of terraform
- terraform-docs to recreate README.md according to terraform module properties
- end-of-file-fixer to ensure that each file ends with newline
To install pre-commit check .
pre-commit install