Skip to content

update repository_name logic to prevent emptyString #4

Merged
merged 1 commit into from
Mar 19, 2026
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions github_files.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ locals {
resource "github_repository_file" "codeowners" {
count = var.create_codeowners && local.should_manage_files && local.github_repo != null ? 1 : 0

repository = local.github_repo.name
repository = local.repository_name
branch = var.github_default_branch
file = "CODEOWNERS"
content = templatefile("${path.module}/templates/CODEOWNERS", { codeowners = local.codeowners })
Expand Down Expand Up @@ -58,13 +58,13 @@ locals {
}
] : []
)
repository_name = local.github_repo != null ? local.github_repo.name : var.name
repository_name = coalesce(try(local.github_repo.name, null), var.name)
}

resource "github_repository_file" "extra_files" {
for_each = local.should_manage_files && local.github_repo != null ? tomap({ for file in local.extra_files : file.path => file }) : {}

repository = local.github_repo.name
repository = local.repository_name
branch = var.files_branch == null ? var.github_default_branch : var.files_branch
file = each.value.path
content = each.value.content
Expand All @@ -87,7 +87,7 @@ resource "github_repository_file" "extra_files" {
resource "github_repository_file" "managed_extra_files" {
for_each = local.should_manage_files && local.github_repo != null ? tomap({ for file in var.managed_extra_files : file.path => file }) : {}

repository = local.github_repo.name
repository = local.repository_name
branch = var.files_branch == null ? var.github_default_branch : var.files_branch
file = each.value.path
content = each.value.content
Expand Down
Loading