diff options
author | Franck Cuny <franck@fcuny.net> | 2022-10-09 13:46:18 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-10-09 13:46:18 -0700 |
commit | 49eefb689159af350b2927e1b5e24e5a80df8eea (patch) | |
tree | 8e1ae08cf4965f1448ef31b90bd0e3e5dcfcb0bb /ops/github | |
parent | ref(ops/github): simplify the configuration (diff) | |
download | world-49eefb689159af350b2927e1b5e24e5a80df8eea.tar.gz |
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.
Diffstat (limited to 'ops/github')
-rw-r--r-- | ops/github/repositories.tf | 13 |
1 files changed, 13 insertions, 0 deletions
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") +} |