Skip to content

Commit de9afce

Browse files
Merge pull request #1 from boostsecurityio/fix/github-pages
upgrade terraform provider and github-pages config
2 parents ee6001a + a13f4c1 commit de9afce

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

main.tf

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ locals {
3737
issue_labels_merge_with_github_labels = local.gh_labels
3838
# Per default, GitHub activates vulnerability alerts for public repositories and disables it for private repositories
3939
vulnerability_alerts = var.vulnerability_alerts != null ? var.vulnerability_alerts : local.private ? false : true
40+
41+
web_commit_signoff_required = var.web_commit_signoff_required == null ? lookup(var.defaults, "web_commit_signoff_required", false) : var.web_commit_signoff_required
4042
}
4143

4244
locals {
@@ -112,6 +114,8 @@ resource "github_repository" "repository" {
112114
archive_on_destroy = var.archive_on_destroy
113115
vulnerability_alerts = local.vulnerability_alerts
114116

117+
web_commit_signoff_required = local.web_commit_signoff_required
118+
115119
dynamic "template" {
116120
for_each = local.template
117121

@@ -125,11 +129,17 @@ resource "github_repository" "repository" {
125129
for_each = var.pages != null ? [true] : []
126130

127131
content {
128-
source {
129-
branch = var.pages.branch
130-
path = try(var.pages.path, "/")
132+
dynamic "source" {
133+
for_each = try(var.pages.build_type, null) == "workflow" ? [] : [true]
134+
135+
content {
136+
branch = var.pages.branch
137+
path = try(var.pages.path, "/")
138+
}
131139
}
132-
cname = try(var.pages.cname, null)
140+
141+
build_type = try(var.pages.build_type, null)
142+
cname = try(var.pages.cname, null)
133143
}
134144
}
135145

@@ -202,9 +212,7 @@ resource "github_branch_protection" "branch_protection" {
202212

203213
allows_deletions = try(var.branch_protections_v4[each.value].allows_deletions, false)
204214
allows_force_pushes = try(var.branch_protections_v4[each.value].allows_force_pushes, false)
205-
blocks_creations = try(var.branch_protections_v4[each.value].blocks_creations, false)
206215
enforce_admins = try(var.branch_protections_v4[each.value].enforce_admins, true)
207-
push_restrictions = try(var.branch_protections_v4[each.value].push_restrictions, [])
208216
require_conversation_resolution = try(var.branch_protections_v4[each.value].require_conversation_resolution, false)
209217
require_signed_commits = try(var.branch_protections_v4[each.value].require_signed_commits, false)
210218
required_linear_history = try(var.branch_protections_v4[each.value].required_linear_history, false)
@@ -219,6 +227,7 @@ resource "github_branch_protection" "branch_protection" {
219227
pull_request_bypassers = try(required_pull_request_reviews.value.pull_request_bypassers, [])
220228
require_code_owner_reviews = try(required_pull_request_reviews.value.require_code_owner_reviews, true)
221229
required_approving_review_count = try(required_pull_request_reviews.value.required_approving_review_count, 0)
230+
require_last_push_approval = try(required_pull_request_reviews.value.require_last_push_approval, true)
222231
}
223232
}
224233

variables.tf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,10 @@ variable "auto_init" {
117117
variable "pages" {
118118
description = "(Optional) The repository's GitHub Pages configuration. (Default: {})"
119119
# type = object({
120-
# branch = string
121-
# path = string
122-
# cname = string
120+
# branch = string
121+
# path = string or null
122+
# cname = string
123+
# build_type = workflow or legacy (requires branch and optional path )
123124
# })
124125
type = any
125126
default = null
@@ -333,9 +334,7 @@ variable "branch_protections_v4" {
333334
# pattern = string
334335
# allows_deletions = optional(bool, false)
335336
# allows_force_pushes = optional(bool, false)
336-
# blocks_creations = optional(bool, false)
337337
# enforce_admins = optional(bool, false)
338-
# push_restrictions = optional(list(string), [])
339338
# require_conversation_resolution = optional(bool, false)
340339
# require_signed_commits = optional(bool, false)
341340
# required_linear_history = optional(bool, false)
@@ -556,6 +555,12 @@ variable "app_installations" {
556555
default = []
557556
}
558557

558+
variable "web_commit_signoff_required" {
559+
type = bool
560+
description = "(Optional) Require contributors to sign off on web-based commits."
561+
default = null
562+
}
563+
559564
# ------------------------------------------------------------------------------
560565
# MODULE CONFIGURATION PARAMETERS
561566
# These variables are used to configure the module.

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ terraform {
99
required_providers {
1010
github = {
1111
source = "integrations/github"
12-
version = ">= 4.20, < 6.0"
12+
version = ">= 4.20, < 7.0"
1313
}
1414
}
1515
}

0 commit comments

Comments
 (0)