Skip to content

Commit

Permalink
fixup! Uplift branch_protection resource to use v4 API
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickmarabeas committed Aug 31, 2020
1 parent 237d79f commit 8146cda
Showing 1 changed file with 13 additions and 25 deletions.
38 changes: 13 additions & 25 deletions website/docs/r/branch_protection.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,19 @@ resource "github_branch_protection" "example" {
required_pull_request_reviews {
dismiss_stale_reviews = true
dismissal_restrictions {
actor_ids = [
data.github_user.example.node_id,
github_team.example.node_id,
]
}
dismissal_restrictions = [
data.github_user.example.node_id,
github_team.example.node_id,
]
}
push_restrictions = [github_team.example.node_id]
push_restrictions = [
data.github_user.example.node_id,
github_team.example.node_id,
]
}
data "github_user" "example" {
resource "github_user" "example" {
username = "example"
}
Expand All @@ -65,7 +66,7 @@ The following arguments are supported:
* `require_signed_commits` - (Optional) Boolean, setting this to `true` requires all commits to be signed with GPG.
* `required_status_checks` - (Optional) Enforce restrictions for required status checks. See [Required Status Checks](#required-status-checks) below for details.
* `required_pull_request_reviews` - (Optional) Enforce restrictions for pull request reviews. See [Required Pull Request Reviews](#required-pull-request-reviews) below for details.
* `push_restrictions` - (Optional) Enforce restrictions for the apps, teams and users that may push to the branch. See [Push Restrictions](#push-restrictions) below for details.
* `push_restrictions` - (Optional) The list of actor IDs that may push to the branch.

### Required Status Checks

Expand All @@ -79,28 +80,15 @@ The following arguments are supported:
`required_pull_request_reviews` supports the following arguments:

* `dismiss_stale_reviews`: (Optional) Dismiss approved reviews automatically when a new commit is pushed. Defaults to `false`.
* `dismissal_actors`: (Optional) The list of actor IDs with dismissal access.
* `require_code_owner_reviews`: (Optional) Require an approved review in pull requests including files with a designated code owner. Defaults to `false`.
* `required_approving_review_count`: (Optional) Require x number of approvals to satisfy branch protection requirements. If this is specified it must be a number between 1-6. This requirement matches Github's API, see the upstream [documentation](https://developer.github.com/v3/repos/branches/#parameters-1) for more information.
* `dismissal_restrictions`: (Optional) Enforce restrictions for the users and teams that may dismiss pull request reviews. See [Dismissal Restrictions](#dismissal-restrictions) below for details.

#### Dismissal Restrictions

`dismissal_restrictions` supports the following arguments:

* `actor_ids`: (Optional) The list of team or user ID's with push access.

### Push Restrictions

`push_restrictions` supports the following arguments:

* `actor_ids`: (Optional) The list of app, team or user ID's with push access.

`push_restrictions` is only available for organization-owned repositories.

## Import

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

```
$ terraform import github_branch_protection.master 1234567
$ terraform import github_branch_protection.terraform terraform:master
```

0 comments on commit 8146cda

Please sign in to comment.