Skip to content

Commit b21a105

Browse files
committed
Add additional options from provider update (patch)
1 parent 95e300a commit b21a105

File tree

2 files changed

+62
-5
lines changed

2 files changed

+62
-5
lines changed

modules/branch-protection/main.tf

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,17 @@ terraform {
1818
# ---------------------------------------------------------------------------------------------------------------------
1919

2020
resource "github_branch_protection" "branch_protection_rule" {
21-
repository_id = var.repository_id
22-
pattern = var.pattern
23-
enforce_admins = var.enforce_admins
24-
require_signed_commits = var.require_signed_commits
25-
push_restrictions = var.push_restrictions
21+
repository_id = var.repository_id
22+
pattern = var.pattern
23+
enforce_admins = var.enforce_admins
24+
require_signed_commits = var.require_signed_commits
25+
push_restrictions = var.push_restrictions
26+
allows_deletions = var.allows_deletions
27+
blocks_creations = var.blocks_creations
28+
allows_force_pushes = var.allows_force_pushes
29+
lock_branch = var.lock_branch
30+
required_linear_history = var.require_linear_history
31+
require_conversation_resolution = var.require_conversation_resolution
2632

2733
required_status_checks {
2834
strict = var.strict
@@ -34,5 +40,7 @@ resource "github_branch_protection" "branch_protection_rule" {
3440
require_code_owner_reviews = var.require_code_owner_reviews
3541
dismissal_restrictions = var.review_dismissal_restrictions
3642
required_approving_review_count = var.required_approving_review_count
43+
pull_request_bypassers = var.pull_request_bypassers
44+
require_last_push_approval = var.require_last_push_approval
3745
}
3846
}

modules/branch-protection/variables.tf

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,49 @@ variable "require_signed_commits" {
5252
default = true
5353
}
5454

55+
variable "require_linear_history" {
56+
description = "Setting this to `true` enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch."
57+
type = bool
58+
default = false
59+
}
60+
61+
variable "require_conversation_resolution" {
62+
description = "Setting this to `true` requires all conversations on code must be resolved before a pull request can be merged."
63+
type = bool
64+
default = true
65+
}
66+
5567
variable "push_restrictions" {
5668
description = "A list of actor IDs that are explicitly permitted to push to the branch. Admins have this capability if `enforce_admins` is false."
5769
type = set(string)
5870
default = []
5971
}
6072

73+
variable "allows_deletions" {
74+
description = "Setting this to `true` allows the branch to be deleted."
75+
type = bool
76+
default = false
77+
}
78+
79+
variable "blocks_creations" {
80+
description = "Setting this to `true` will prevent creation of the branch."
81+
type = bool
82+
default = false
83+
}
84+
85+
variable "allows_force_pushes" {
86+
description = "Setting this to `true` allows the branch to accept for pushes."
87+
type = bool
88+
default = true
89+
}
90+
91+
variable "lock_branch" {
92+
description = "Setting this to `true` will make the branch read-only and prevent any pushes to it."
93+
type = bool
94+
default = false
95+
}
96+
97+
6198
variable "review_dismissal_restrictions" {
6299
description = "The list of actor IDs with dismissal access."
63100
type = set(string)
@@ -69,3 +106,15 @@ variable "required_approving_review_count" {
69106
type = number
70107
default = 1
71108
}
109+
110+
variable "pull_request_bypassers" {
111+
description = "A list of actor names or IDs that are allowed to bypass pull request requirements. Actor names must either begin with a `/` for users or the organization name followed by a `/` for teams."
112+
type = set(string)
113+
default = []
114+
}
115+
116+
variable "require_last_push_approval" {
117+
description = "Require that the most recent push must be approved by someone other than the last pusher. Defaults to `false`."
118+
type = bool
119+
default = false
120+
}

0 commit comments

Comments
 (0)