From 29b7b1b7011a3c0d916f81379848d1c9080d7d9d Mon Sep 17 00:00:00 2001 From: Dave Arnold Date: Tue, 18 Feb 2025 21:00:33 -0800 Subject: [PATCH] Update branch protection count logic to include repository creation condition --- github_branch.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github_branch.tf b/github_branch.tf index c188c8b..6a42a23 100644 --- a/github_branch.tf +++ b/github_branch.tf @@ -33,7 +33,7 @@ locals { # https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch_protection resource "github_branch_protection" "main" { - count = (var.enforce_prs && !var.github_is_private) || var.github_is_private ? 1 : 0 + count = var.create_repo && (var.enforce_prs && !var.github_is_private) || var.github_is_private ? 1 : 0 repository_id = local.github_repo.node_id pattern = var.github_default_branch