Skip to content

Commit 44ac511

Browse files
feat(boostsecurityio): Github pages, web_commit_signoff_required, and terraform provider 6.x fixing pages (#5)
* update for terraform provider 6.x fixing pages * add web_commit_signoff_required * doc: Update CHANGELOG --------- Co-authored-by: Jonathan Serafini <jonathan@serafini.ca>
1 parent ee13dab commit 44ac511

File tree

4 files changed

+33
-12
lines changed

4 files changed

+33
-12
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.19.1]
11+
12+
### Changed
13+
14+
JonathanSerafini: update for terraform provider 6.x fixing pages
15+
JonathanSerafini: add web_commit_signoff_required
16+
1017
## [0.19.0]
1118

1219
### Changed

main.tf

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ locals {
4242
issue_labels_merge_with_github_labels = local.gh_labels
4343
# Per default, GitHub activates vulnerability alerts for public repositories and disables it for private repositories
4444
vulnerability_alerts = var.vulnerability_alerts != null ? var.vulnerability_alerts : local.private ? false : true
45+
46+
web_commit_signoff_required = var.web_commit_signoff_required == null ? lookup(var.defaults, "web_commit_signoff_required", false) : var.web_commit_signoff_required
4547
}
4648

4749
locals {
@@ -117,6 +119,8 @@ resource "github_repository" "repository" {
117119
archive_on_destroy = var.archive_on_destroy
118120
vulnerability_alerts = local.vulnerability_alerts
119121

122+
web_commit_signoff_required = local.web_commit_signoff_required
123+
120124
squash_merge_commit_title = local.squash_merge_commit_title
121125
squash_merge_commit_message = local.squash_merge_commit_message
122126
merge_commit_title = local.merge_commit_title
@@ -135,11 +139,17 @@ resource "github_repository" "repository" {
135139
for_each = var.pages != null ? [true] : []
136140

137141
content {
138-
source {
139-
branch = var.pages.branch
140-
path = try(var.pages.path, "/")
142+
dynamic "source" {
143+
for_each = try(var.pages.build_type, null) == "workflow" ? [] : [true]
144+
145+
content {
146+
branch = var.pages.branch
147+
path = try(var.pages.path, "/")
148+
}
141149
}
142-
cname = try(var.pages.cname, null)
150+
151+
build_type = try(var.pages.build_type, null)
152+
cname = try(var.pages.cname, null)
143153
}
144154
}
145155

@@ -212,9 +222,7 @@ resource "github_branch_protection" "branch_protection" {
212222

213223
allows_deletions = try(var.branch_protections_v4[each.value].allows_deletions, false)
214224
allows_force_pushes = try(var.branch_protections_v4[each.value].allows_force_pushes, false)
215-
blocks_creations = try(var.branch_protections_v4[each.value].blocks_creations, false)
216225
enforce_admins = try(var.branch_protections_v4[each.value].enforce_admins, true)
217-
push_restrictions = try(var.branch_protections_v4[each.value].push_restrictions, [])
218226
require_conversation_resolution = try(var.branch_protections_v4[each.value].require_conversation_resolution, false)
219227
require_signed_commits = try(var.branch_protections_v4[each.value].require_signed_commits, false)
220228
required_linear_history = try(var.branch_protections_v4[each.value].required_linear_history, false)
@@ -229,6 +237,7 @@ resource "github_branch_protection" "branch_protection" {
229237
pull_request_bypassers = try(required_pull_request_reviews.value.pull_request_bypassers, [])
230238
require_code_owner_reviews = try(required_pull_request_reviews.value.require_code_owner_reviews, true)
231239
required_approving_review_count = try(required_pull_request_reviews.value.required_approving_review_count, 0)
240+
require_last_push_approval = try(required_pull_request_reviews.value.require_last_push_approval, true)
232241
}
233242
}
234243

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
variable "squash_merge_commit_title" {
560565
type = string
561566
description = "(Optional) Can be `PR_BODY`, `COMMIT_MESSAGES`, or `BLANK` for a default squash merge commit message."

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.31, < 6.0"
12+
version = ">= 4.31, < 7.0"
1313
}
1414
}
1515
}

0 commit comments

Comments
 (0)