Skip to content

Commit

Permalink
add a comment with repository_file optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh committed May 5, 2022
1 parent a8dc1e3 commit b623348
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion terraform/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,31 @@ data "github_repository" "this" {
# @resources.team_membership.data
data "github_organization_teams" "this" {}

# once https://github.com/integrations/terraform-provider-github/issues/1131 is resolved
# we can replace data.github_branch.this and data.github_tree.this with the following:
# data "github_repository_file" "this" {
# for_each = merge([
# for repository, files in lookup(local.github, "repository_file", {}) :
# {
# for file, config in {
# for file, config in files :
# file => merge({
# branch = lookup(config, "branch", data.github_repository.this[repository].default_branch)
# }, config) if contains(keys(data.github_repository.this), repository)
# } :
# "${repository}/${file}:${config.branch}" => {
# repository = repository
# file = file
# branch = config.branch
# }
# }
# ]...)
#
# repository = each.value.repository
# file = each.value.file
# branch = each.value.branch
# }

data "github_branch" "this" {
for_each = merge([
for repository, files in lookup(local.github, "repository_file", {}) :
Expand Down Expand Up @@ -55,5 +80,5 @@ data "github_tree" "this" {

recursive = true
repository = each.value.repository
tree_sha = data.value.sha
tree_sha = each.value.sha
}

0 comments on commit b623348

Please sign in to comment.