-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsecurity.tf
More file actions
64 lines (53 loc) · 1.88 KB
/
security.tf
File metadata and controls
64 lines (53 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# see https://registry.terraform.io/providers/integrations/github/latest/docs/resources/organization_security_manager
resource "github_organization_security_manager" "main" {
team_slug = github_team.maintainers.slug
}
locals {
non_terraform_repositories = merge(
module.repositories["container-images"],
module.repositories["packer-templates"],
)
}
# see https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch_protection
resource "github_branch_protection" "main" {
# see https://developer.hashicorp.com/terraform/language/meta-arguments/for_each
for_each = merge(
module.terraform_repositories,
)
repository_id = each.key
pattern = "main"
# enforce status checks for administrators
# enforce_admins = true
# require all commits to be GPG-signed
# require_signed_commits = true
# prevent actors from pushing merge commits
required_linear_history = true
# require actors to address all conversations
require_conversation_resolution = true
# TODO required_status_checks
# https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch_protection#required_status_checks
# required_pull_request_reviews {
# # dismiss approved reviews when new commits are pushed
# dismiss_stale_reviews = true
#
# restrict_dismissals = true
#
# # only allow maintainers to dismiss pull request reviess
# # dismissal_restrictions = [
# # "${var.github_owner}/${github_team.maintainers.slug}",
# # ]
#
# # require_code_owner_reviews = true
#
# # require at least one review approval
# # required_approving_review_count = 1
# }
# only allow maintainers to push to `main`
restrict_pushes {
push_allowances = [
"${var.github_owner}/${github_team.maintainers.slug}"
]
}
# disallow deletion of the `main` branch
allows_deletions = false
}