Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/terraform-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- name: Terraform Init
id: init
run: terraform init
run: terraform init -upgrade

- name: Terraform Validate
id: validate
Expand Down
153 changes: 102 additions & 51 deletions terraform/github/branches.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ resource "github_branch_protection" "ansible_branch_protection" {
# being able to merge. Also this should prevent outsiders from pushing to the protected branch,
# however, whilst they can open a pull request they shoud not be able to merge that would be
# upto the reviewers or codeowners.
push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_status_checks {
contexts = lookup(var.required_status_checks, each.key, { "default" : [] }).default
Expand All @@ -47,9 +50,12 @@ resource "github_branch_protection" "batch_branch_protection" {
required_approving_review_count = 1
}

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_status_checks {
contexts = lookup(var.required_status_checks, each.key, { "default" : [] }).default
Expand Down Expand Up @@ -80,9 +86,12 @@ resource "github_branch_protection" "kayobe_branch_protection_py_3-6" {
required_approving_review_count = 1
}

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_status_checks {
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/[vwxy]*", lookup(var.required_status_checks, each.key, {
Expand Down Expand Up @@ -114,9 +123,12 @@ resource "github_branch_protection" "kayobe_branch_protection_zed" {
required_approving_review_count = 1
}

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_status_checks {
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/zed", lookup(var.required_status_checks, each.key, {
Expand Down Expand Up @@ -149,9 +161,12 @@ resource "github_branch_protection" "kayobe_branch_protection_antelope" {
required_approving_review_count = 1
}

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_status_checks {
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/2023.1", lookup(var.required_status_checks, each.key, {
Expand Down Expand Up @@ -184,9 +199,12 @@ resource "github_branch_protection" "kayobe_branch_protection_caracal" {
required_approving_review_count = 1
}

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_status_checks {
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/2024.1", lookup(var.required_status_checks, each.key, {
Expand Down Expand Up @@ -218,9 +236,12 @@ resource "github_branch_protection" "kayobe_branch_protection_epoxy" {
required_approving_review_count = 1
}

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_status_checks {
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/2025.1", lookup(var.required_status_checks, each.key, {
Expand Down Expand Up @@ -254,9 +275,12 @@ resource "github_branch_protection" "kayobe_branch_protection_master" {
required_approving_review_count = 1
}

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_status_checks {
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/master", lookup(var.required_status_checks, each.key, {
Expand Down Expand Up @@ -286,9 +310,12 @@ resource "github_branch_protection" "openstack_branch_protection_py_3-6" {
allows_deletions = false
allows_force_pushes = false

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_pull_request_reviews {
dismiss_stale_reviews = true
Expand Down Expand Up @@ -319,9 +346,12 @@ resource "github_branch_protection" "openstack_branch_protection_zed" {
allows_deletions = false
allows_force_pushes = false

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_pull_request_reviews {
dismiss_stale_reviews = true
Expand Down Expand Up @@ -354,9 +384,12 @@ resource "github_branch_protection" "openstack_branch_protection_antelope" {
allows_deletions = false
allows_force_pushes = false

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_pull_request_reviews {
dismiss_stale_reviews = true
Expand Down Expand Up @@ -389,9 +422,12 @@ resource "github_branch_protection" "openstack_branch_protection_caracal" {
allows_deletions = false
allows_force_pushes = false

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_pull_request_reviews {
dismiss_stale_reviews = true
Expand Down Expand Up @@ -423,9 +459,12 @@ resource "github_branch_protection" "openstack_branch_protection_epoxy" {
allows_deletions = false
allows_force_pushes = false

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_pull_request_reviews {
dismiss_stale_reviews = true
Expand Down Expand Up @@ -458,9 +497,12 @@ resource "github_branch_protection" "openstack_branch_protection_master" {
allows_deletions = false
allows_force_pushes = false

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_pull_request_reviews {
dismiss_stale_reviews = true
Expand Down Expand Up @@ -499,9 +541,12 @@ resource "github_branch_protection" "platform_branch_protection" {
required_approving_review_count = 1
}

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_status_checks {
contexts = lookup(var.required_status_checks, each.key, { "default" : [] }).default
Expand All @@ -528,9 +573,12 @@ resource "github_branch_protection" "releasetrain_branch_protection" {
required_approving_review_count = 1
}

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_status_checks {
contexts = lookup(var.required_status_checks, each.key, { "default" : [] }).default
Expand All @@ -557,9 +605,12 @@ resource "github_branch_protection" "smslab_branch_protection" {
required_approving_review_count = 1
}

push_restrictions = [
resource.github_team.organisation_teams["Developers"].node_id
]
restrict_pushes {
blocks_creations = false
push_allowances = [
resource.github_team.organisation_teams["Developers"].node_id
]
}

required_status_checks {
contexts = lookup(var.required_status_checks, each.key, { "default" : [] }).default
Expand Down
4 changes: 2 additions & 2 deletions terraform/github/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
github = {
source = "integrations/github"
version = "4.28.0"
version = "6.11.1"
}
}
cloud {
Expand All @@ -27,4 +27,4 @@ provider "github" {
# provider "github" {
# owner = var.owner
# token = var.GITHUB_TOKEN
# }
# }
4 changes: 1 addition & 3 deletions terraform/github/repositories.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ resource "github_repository" "repositories" {
ignore_changes = [
description,
homepage_url,
private,
visibility,
has_discussions,
has_issues,
has_projects,
has_wiki,
Expand All @@ -20,14 +20,12 @@ resource "github_repository" "repositories" {
auto_init,
gitignore_template,
license_template,
default_branch,
archived,
archive_on_destroy,
pages,
topics,
template,
vulnerability_alerts,
ignore_vulnerability_alerts_during_read
]
prevent_destroy = true
}
Expand Down