locals {
repositories = [
{
name = "newsletter"
description = "Newsletter simple system"
archive_on_destroy = false
is_private = false
},
]
}
module "repositories" {
source = "../_modules/github-repository" // custom, not shown here
for_each = { for item in local.repositories: item.name => item }
description = each.value.description
name = each.value.name
is_private = try(each.value.is_private, true)
has_issues = try(each.value.has_issues, false)
has_downloads = try(each.value.has_downloads, false)
has_projects = try(each.value.has_projects, false)
has_wiki = try(each.value.has_wiki, false)
delete_branch_on_merge = try(each.value.delete_branch_on_merge, true)
archive_on_destroy = try(each.value.archive_on_destroy, true)
topics = try(each.value.topics, [])
archived = try(each.value.archived, false)
}
resource "github_repository" "this" {
name = var.name
description = var.description
visibility = var.is_private ? "private" : "public"
has_issues = var.has_issues
has_downloads = var.has_downloads
has_projects = var.has_projects
has_wiki = var.has_wiki
delete_branch_on_merge = var.delete_branch_on_merge
archive_on_destroy = var.archive_on_destroy
archived = var.archived
topics = var.topics
}