Skip to content

Commit

Permalink
fix: update dependencies in branch protection and uncomment repositor…
Browse files Browse the repository at this point in the history
…y data resources
  • Loading branch information
arnol377 committed Apr 4, 2025
1 parent 0b28977 commit e4dab44
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
5 changes: 4 additions & 1 deletion branch_protection.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ resource "github_branch_protection" "protection" {
depends_on = [
github_repository.repo,
github_branch.branch,
github_branch_default.default_main_branch
github_branch_default.default_main_branch,
github_repository_files.extra_files,
github_repository_file.codeowners,
github_repository_file.managed_extra_files
]
}
32 changes: 16 additions & 16 deletions github_files.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@ resource "github_repository_file" "codeowners" {
}
}

# data "github_repository" "template_repo" {
# count = var.template_repo == null && var.template_repo_org == var.repo_org ? 0 : 1
# full_name = "${var.template_repo_org == null ? "" : var.template_repo_org}/${var.template_repo == null ? "" : var.template_repo}"
# }
data "github_repository" "template_repo" {
count = var.template_repo == null && var.template_repo_org == var.repo_org ? 0 : 1
full_name = "${var.template_repo_org == null ? "" : var.template_repo_org}/${var.template_repo == null ? "" : var.template_repo}"
}

# data "github_ref" "ref" {
# count = var.template_repo == null && var.template_repo_org == var.repo_org ? 0 : 1
# owner = var.template_repo_org
# repository = var.template_repo
# ref = "heads/${element(data.github_repository.template_repo, 0).default_branch}"
# }
data "github_ref" "ref" {
count = var.template_repo == null && var.template_repo_org == var.repo_org ? 0 : 1
owner = var.template_repo_org
repository = var.template_repo
ref = "heads/${element(data.github_repository.template_repo, 0).default_branch}"
}

locals {
extra_files = concat(
var.extra_files,
# var.template_repo == null && var.template_repo_org == var.repo_org ? [] : [
# {
# path = ".TEMPLATE_SHA",
# content = data.github_ref.ref[0].sha
# }
# ]
var.template_repo == null && var.template_repo_org == var.repo_org ? [] : [
{
path = ".TEMPLATE_SHA",
content = data.github_ref.ref[0].sha
}
]
)
repository_name = var.create_repo ? local.github_repo.name : var.name
}
Expand Down

0 comments on commit e4dab44

Please sign in to comment.