about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ops/github/repositories.tf6
1 files changed, 3 insertions, 3 deletions
diff --git a/ops/github/repositories.tf b/ops/github/repositories.tf
index 2465d43..15a5b1d 100644
--- a/ops/github/repositories.tf
+++ b/ops/github/repositories.tf
@@ -7,7 +7,7 @@ resource "github_repository" "repos" {
 
   name                   = try(each.value.name, each.key)
   visibility             = each.value.visibility
-  archived               = each.value.archived
+  archived               = try(each.value.archived, false)
   description            = try(each.value.description, null)
   has_downloads          = false
   has_issues             = try(each.value.has_issues, true)
@@ -17,7 +17,7 @@ resource "github_repository" "repos" {
   allow_squash_merge     = true
   allow_rebase_merge     = true
   vulnerability_alerts   = try(each.value.vulnerability_alerts, false)
-  delete_branch_on_merge = try(each.value.vulnerability_alerts, false)
+  delete_branch_on_merge = try(!each.value.archived, true)
 }
 
 resource "github_branch_default" "main" {
@@ -26,7 +26,7 @@ resource "github_branch_default" "main" {
   # use the name for the repository if set
   for_each = {
     for k, v in local.repositories : try(v.name, k) => v
-    if v.archived == false
+    if try(v.archived, false) == false
   }
 
   repository = each.key