integrations / terraform-provider-github

Terraform GitHub provider
https://www.terraform.io/docs/providers/github/
MIT License
879 stars 719 forks source link

[BUG]: Validation prevents valid `results_per_page` setting #2172

Closed dschniepp closed 5 months ago

dschniepp commented 5 months ago

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

Affected Resource(s)

Terraform Configuration Files

No response

Steps to Reproduce

No response

Debug Output

No response

Panic Output

No response

Code of Conduct

Daniel Schniepp daniel.schniepp@mercedes-benz.com, Mercedes-Benz Mobility AG on behalf of Mercedes-Benz Tech Innovation GmbH.

kfcampbell commented 5 months ago

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.

dschniepp commented 5 months ago

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
kfcampbell commented 5 months ago

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?

dschniepp commented 5 months ago

Thank you. I will submit a PR.