Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to the branch protection setup #16

Merged
merged 15 commits into from
Feb 16, 2023
Merged
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.14.7
terraform_version: 1.3.7
- name: terraform fmt
run: |
terraform fmt -check -recursive
Expand Down
35 changes: 17 additions & 18 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions github_repository.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ resource "github_branch_default" "default" {
branch = var.default_branch_name
}

resource "github_branch_protection_v3" "repository_main" {

resource "github_branch_protection" "repository_main" {
count = var.branch_protection_enabled == true ? 1 : 0

repository = github_repository.repository.name
branch = var.default_branch_name
repository_id = github_repository.repository.name
pattern = var.default_branch_name
enforce_admins = var.enforce_admins

required_status_checks {
Expand All @@ -86,5 +87,7 @@ resource "github_actions_secret" "repository_secret" {
repository = github_repository.repository.name
secret_name = each.key
plaintext_value = each.value


}

2 changes: 1 addition & 1 deletion terraform.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.26.1"
version = "4.31.0"
}
}
required_version = ">= 1.0.0"
Expand Down