From 49eefb689159af350b2927e1b5e24e5a80df8eea Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 9 Oct 2022 13:46:18 -0700 Subject: feat(ops/github): set the name of the default branch From now on we should always be using 'main'. If a project requires 'master', it will need to be set explicitly. --- ops/github/repositories.tf | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ops/github/repositories.tf b/ops/github/repositories.tf index 506f0dd..2465d43 100644 --- a/ops/github/repositories.tf +++ b/ops/github/repositories.tf @@ -19,3 +19,16 @@ resource "github_repository" "repos" { vulnerability_alerts = try(each.value.vulnerability_alerts, false) delete_branch_on_merge = try(each.value.vulnerability_alerts, false) } + +resource "github_branch_default" "main" { + # no need to set the default branch if the repository is already + # archived. + # 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 + } + + repository = each.key + branch = try(each.value.default_branch, "main") +} -- cgit 1.4.1