Skip to content

Commit f300c19

Browse files
committed
chore: guard against empty map
Signed-off-by: Trevor Wood <Trevor.G.Wood@gmail.com>
1 parent d17416d commit f300c19

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ resource "github_branch_default" "default" {
181181
# ---------------------------------------------------------------------------------------------------------------------
182182

183183
resource "github_branch_protection" "this" {
184-
for_each = coalesce(var.branch_protections_v4, {})
184+
for_each = length(coalesce(var.branch_protections_v4, {})) > 0 ? var.branch_protections_v4 : {}
185185

186186
# ensure we have all members and collaborators added before applying
187187
# any configuration for them
@@ -232,7 +232,7 @@ resource "github_branch_protection" "this" {
232232
# ---------------------------------------------------------------------------------------------------------------------
233233

234234
resource "github_branch_protection_v3" "branch_protection" {
235-
count = var.branch_protections_v4 == null ? length(local.branch_protections_v3) : 0
235+
count = length(coalesce(var.branch_protections_v4, {})) == 0 ? length(local.branch_protections_v3) : 0
236236

237237
# ensure we have all members and collaborators added before applying
238238
# any configuration for them

0 commit comments

Comments
 (0)