about summary refs log tree commit diff
path: root/ops
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-10-24 17:48:35 -0700
committerFranck Cuny <franck@fcuny.net>2022-10-24 17:48:35 -0700
commit278f18161d4c37774520f53961b36bd52906920a (patch)
tree4375df8e5660e546e8a0f9639270a953938a68b4 /ops
parentfeat(system/fonts): add cascadia (diff)
downloadworld-278f18161d4c37774520f53961b36bd52906920a.tar.gz
fix(ops/github): create resources in correct order
We first need to create a repository before we can create the default
branch. For the default branch to be set, we also need the repository to
contain a commit, which is achieved with the `auto_init' attribute.

We can always push with `--force' to overwrite that initial commit when
doing the migration.
Diffstat (limited to 'ops')
-rw-r--r--ops/github/repositories.tf2
1 files changed, 2 insertions, 0 deletions
diff --git a/ops/github/repositories.tf b/ops/github/repositories.tf
index ba5cf60..38e5de2 100644
--- a/ops/github/repositories.tf
+++ b/ops/github/repositories.tf
@@ -18,9 +18,11 @@ resource "github_repository" "repos" {
   allow_rebase_merge     = false
   vulnerability_alerts   = try(each.value.vulnerability_alerts, false)
   delete_branch_on_merge = try(!each.value.archived, true)
+  auto_init              = true
 }
 
 resource "github_branch_default" "main" {
+  depends_on = [github_repository.repos]
   # no need to set the default branch if the repository is already
   # archived.
   # use the name for the repository if set