Skip to content

Commit

Permalink
update repository_name logic to prevent emptyString
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Mar 19, 2026
1 parent 344845e commit 9c2902d
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 9c2902d

Please sign in to comment.