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

[BUG]: Validation prevents valid `results_per_page` setting

Open dschniepp opened this issue 1 year ago • 1 comments

Expected Behavior

According to the docs 1000 results per page should be allowed.

Actual Behavior

The maximum number of allow results is 100, according to toDiagFunc(validation.IntBetween(0, 100), "results_per_page")

Terraform Version

Terraform v1.7.4 on darwin_arm64

  • provider registry.terraform.io/integrations/github v6.0.0

Affected Resource(s)

  • github_repositories

Terraform Configuration Files

No response

Steps to Reproduce

No response

Debug Output

No response

Panic Output

No response

Code of Conduct

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

Daniel Schniepp [email protected], Mercedes-Benz Mobility AG on behalf of Mercedes-Benz Tech Innovation GmbH.

dschniepp avatar Mar 01 '24 16:03 dschniepp

I think you might be looking at the wrong docs. For getting organization repositories, the docs are here and show a max of 100:

image

The docs you've linked are for the search API, which doesn't apply for the data source for organization repos.

kfcampbell avatar Mar 04 '24 21:03 kfcampbell

Thank you for pointing it out, I only saw this in the terraform registry, for the github_repositories data resource. So I think the documentation is then wrong, as I didn't check the GitHub API.

Bildschirmfoto 2024-03-05 um 16 52 30

dschniepp avatar Mar 05 '24 15:03 dschniepp

Okay I've had a chance to look at this a little longer and now I think you're right and I'm wrong. The API to retrieve organization repositories does indeed only allow 30 results per page, but upon closer inspection this data source calls the search API which allows 1000 results per page, and not the list repositories endpoint. I was confused.

Would you like to create a PR to modify the validation function, or shall I?

kfcampbell avatar Mar 05 '24 21:03 kfcampbell

Thank you. I will submit a PR.

dschniepp avatar Mar 05 '24 23:03 dschniepp