-
-
Save cpswan/76f70da05b4f8929b84db4f51a76b672 to your computer and use it in GitHub Desktop.
Terraform for GitHub repo branch protection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terraform { | |
required_providers { | |
github = { | |
source = "integrations/github" | |
version = "~> 4.0" | |
} | |
} | |
} | |
# Configure the GitHub Provider | |
provider "github" { | |
owner = var.gh_org | |
} | |
# Set protection | |
resource "github_branch_protection" "at_repos" { | |
count = "${length(var.at_repos)}" | |
repository_id = "${var.at_repos[count.index]}" | |
pattern = "trunk" | |
enforce_admins = "true" | |
required_pull_request_reviews { | |
dismiss_stale_reviews = true | |
required_approving_review_count = 1 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gh_org = "atsign-foundation" | |
at_repos = [ | |
"at_pico_w", | |
"at_widgets", | |
"atmosphere_pro", | |
"at_client_sdk", | |
"at_server", | |
"at_wavi_app", | |
"at_tools", | |
"at_mono", | |
"at_java", | |
"at_libraries", | |
"at_services", | |
"private_fit", | |
"arrive", | |
"sshnoports", | |
"at_talk", | |
"atsign.dev-3.0", | |
"iot.atsign.dev", | |
"at_app", | |
"at_protocol", | |
"FHIR-atHack", | |
"dess", | |
"privatefit", | |
"open_source_app_default", | |
"at_email", | |
"at_dude", | |
"mwc_demo", | |
"at_demos", | |
"atsign.dev", | |
"at-bot", | |
"max30101", | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "gh_org" { | |
type = string | |
} | |
variable "at_repos" { | |
type = list | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment