terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

[BUG]: detailed_repositories in github_team data_source truncates to last page

Open bmv0161 opened this issue 1 year ago • 2 comments

Expected Behavior

When referencing the detailed_repositories attribute from a github_team data source, all team repositories are expected.

Actual Behavior

The list of repositories is truncated based on the results_per_page. I think it is caused by the following line: https://github.com/integrations/terraform-provider-github/blob/5752b2581349fcf4dc7be0c093445591abdfbe91/github/data_source_github_team.go#L177C5-L177C5

data.github_team.team: Reading...
data.github_team.team: Still reading... [10s elapsed]
data.github_team.team: Read complete after 17s [id=<teamid>]

Changes to Outputs:
  + team_repos          = [
      + "example1",
      + "example2",
      + "example3",
      + "example4",
      + "example5",
    ]
  + team_repos_detailed = [
      + {
          + repo_id   = <example4>
          + role_name = "read"
        },
      + {
          + repo_id   = <example5>
          + role_name = "read"
        }
    ]

You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.

Terraform Version

Terraform v1.6.6 on windows_amd64

  • provider registry.terraform.io/integrations/github v5.44.0

Affected Resource(s)

  • github_team

Terraform Configuration Files

data "github_team" "team" {
  slug = "example"
  results_per_page = 3
}

output "team_repos_detailed" {
  value = data.github_team.team.repositories_detailed
}
output "team_repos" {
  value = data.github_team.team.repositories
}

Steps to Reproduce

terraform plan

Debug Output

No response

Panic Output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

bmv0161 avatar Jan 12 '24 16:01 bmv0161

It would also be nice if detailed_repositories included the repo name as referenced here: https://github.com/integrations/terraform-provider-github/issues/1670#issuecomment-1537157377

bmv0161 avatar Jan 12 '24 17:01 bmv0161

Hey @bmv0161 thanks for tracking this down. Let us know if you'd be interested in fixing the issue and submitting a PR. For now I have labeled this as "Up For Grabs" so that the community can take a stab at getting this fixed as well. ❤️

nickfloyd avatar Jan 19 '24 16:01 nickfloyd

Any updates on this issue? Happy to help if help is still needed!

n47h4n12 avatar Apr 23 '24 20:04 n47h4n12

@n47h4n12 please feel free to submit a PR if you'd like!

kfcampbell avatar Apr 29 '24 23:04 kfcampbell

@kfcampbell PR #2248 has been submitted. Can you please review?

n47h4n12 avatar May 02 '24 18:05 n47h4n12