You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since we're doing large queries across lots of objects in GitHub, using GraphQL will be significantly faster and use up less of the API Rate Limit.
Both reading and writing (mutating) are supported.
Reacted by Marcel Hauf, Robert, Christopher Trom, Johnathan Constance, Julian V. Modesto, Mark Bainter, Linus Unnebäck, Ankit Jain, Mark Diez, Kyle Christensen and 23 more
We hit our rate limits daily (150 Repos, 30 teams, and ~200 users in the org) and a lot of it is just because of plans fetching repos/teams/team memberships one by one.
Switching to graphQL will help alleviate this significantly.
Reacted by Ankit Jain, Jan Hentschel, Manivannan Giridharan, Martin Schneppenheim, Kevin Behrens, Colin Harrington, Yevhen Sakhniuk, Michele Degges and Satyam Zode
A simple GraphQL API based cache layer that is used while refreshing any resource will speed up operations by a lot. (One call to fetch a list of all repositories and then cache this for when a repository information is fetched.
The API surface for many of these is pretty different. Feedback would be good as to just how backwards compatible these need to be. In my opinion much of the data that was being returned was irrelevant within the context of Terraform.
It is certainly possible; for example, in the OpenStack provider many resources have _v1, _v2, and _v3 flavors in order to accommodate users with different needs. This provider could provide _v4 flavors of the resources for users who want to upgrade.
What would the "upgrade" / "downgrade" path be between the different resources? State migration?
Won't this be fairly painful with differences in IDs between the resources? At least when it's the same resource you can include an upgrade function which manages this stuff...
I've done some preliminary tests on handling the two different APIs using two separate providers. It seems to be the better choice.
This way the resources themselves remain consistent and should allow for upgrade functions to work if we start v4 schema versions from say, v100, so there's no possible clash of a resource version between the two providers. Every version can have an update function - hopefully in both directions as well.
As long as resources all use GitHub's IDs to track objects, then switching between v3 and v4 should be easy. e.g. use repositoryId instead of the org/repo.
Any news on this? This is really hitting us hard. It's really overdue that the provider utilizes the features introduced several years ago. Are there any plans on moving to the GraphQL API?
@kfcampbell, yes sure. I'm particularly interested in having the resource github_repository_file implement that. Currently we're doing quite a lot with it and are hitting the rate limit quickly because every file is read/committed separately. It's just a waste of API calls the way this functionality is currently implemented in the provider.
@nickfloyd@kfcampbell Sorry for the late response, guys. Unfortunately neither time nor skills provide that I fix this in a PR. Not my area of expertise (yet), but I'm happy to see that it already got picked up with high priority. 💯
If I can be of any assistance in shaping the requirements of this feature or any other way, just let me know. I'd be really grateful if the github_repository_file resource would be a bit more thrifty in API calls. And I don't think I'm the only one.
@spr-mweber3 can I talk you into creating an issue for the particular resource(s) you want migrated over to the GraphQL API? I'd like to close this issue as-is, since we're not going to be doing a single PR to cut over every resource the GraphQL API would support.
Activity
joebowbeer commentedon Sep 4, 2018
AFAIK, repository creation (https://developer.github.com/v3/repos/#create 30) and content retrieval (https://developer.github.com/v3/repos/contents/#get-contents 11) are still only supported in the v3 (REST) API.
https://platform.github.community/t/schema-request-create-repository-and-get-repository-contents/1833
captn3m0 commentedon Jan 28, 2019
We hit our rate limits daily (150 Repos, 30 teams, and ~200 users in the org) and a lot of it is just because of plans fetching repos/teams/team memberships one by one.
Switching to graphQL will help alleviate this significantly.
deppy commentedon Jul 30, 2019
They're adding additional functionality into the graphQL/v4 api that isn't being added to v3. (traige and maintain permissions for example)
@joebowbeer looks like repo creation has been added, didn't see a get-contents equivalent though.
captn3m0 commentedon Jul 30, 2019
A simple GraphQL API based cache layer that is used while refreshing any resource will speed up operations by a lot. (One call to fetch a list of all repositories and then cache this for when a repository information is fetched.
That way it could use both?
patrickmarabeas commentedon Jan 21, 2020
I've done a fair amount of work on a GraphQL version of the provider.
The two major foundational pieces look to be:
This would then allow resources to be uplifted as required or when possible - the GraphQL API is still pretty barebones.
I'll start to look at merging the work I've done back in.
patrickmarabeas commentedon Feb 10, 2020
The API surface for many of these is pretty different. Feedback would be good as to just how backwards compatible these need to be. In my opinion much of the data that was being returned was irrelevant within the context of Terraform.
Addition of v4 client: https://github.com/terraform-providers/terraform-provider-github/pull/331
Data sources:
ip_rangeshttps://github.com/terraform-providers/terraform-provider-github/pull/334repositoryhttps://github.com/terraform-providers/terraform-provider-github/pull/335repositorieshttps://github.com/terraform-providers/terraform-provider-github/pull/336collaboratorshttps://github.com/terraform-providers/terraform-provider-github/pull/338teamhttps://github.com/terraform-providers/terraform-provider-github/pull/339userhttps://github.com/terraform-providers/terraform-provider-github/pull/340codeowners(new) https://github.com/terraform-providers/terraform-provider-github/pull/332members(new) https://github.com/terraform-providers/terraform-provider-github/pull/333Resources:
branch_protectionhttps://github.com/terraform-providers/terraform-provider-github/pull/337Resource IDs:
repositoryhttps://github.com/terraform-providers/terraform-provider-github/pull/341julianvmodesto commentedon Feb 10, 2020
Would it be possible to select the API version for a resource, if v3 and v4 are supported?
The v3 API has conditional requests, which allows for read requests to be cached, so it would be good to keep resources at v3 (at least the reads).
kpfleming commentedon Feb 10, 2020
It is certainly possible; for example, in the OpenStack provider many resources have _v1, _v2, and _v3 flavors in order to accommodate users with different needs. This provider could provide _v4 flavors of the resources for users who want to upgrade.
patrickmarabeas commentedon Feb 16, 2020
What would the "upgrade" / "downgrade" path be between the different resources? State migration?
Won't this be fairly painful with differences in IDs between the resources? At least when it's the same resource you can include an upgrade function which manages this stuff...
patrickmarabeas commentedon Feb 25, 2020
I would like to keep momentum on this work - who needs to be involved in deciding how this should proceed?
patrickmarabeas commentedon Feb 28, 2020
I've done some preliminary tests on handling the two different APIs using two separate providers. It seems to be the better choice.
This way the resources themselves remain consistent and should allow for upgrade functions to work if we start v4 schema versions from say, v100, so there's no possible clash of a resource version between the two providers. Every version can have an update function - hopefully in both directions as well.
How does this sit with everyone?
patrickmarabeas commentedon Mar 10, 2020
PR to help interface v3 and v4 data sources and resources: https://github.com/terraform-providers/terraform-provider-github/pull/383
docwhat commentedon Mar 10, 2020
As long as resources all use GitHub's IDs to track objects, then switching between v3 and v4 should be easy. e.g. use
repositoryIdinstead of theorg/repo.16 remaining items
markediez commentedon Feb 18, 2022
Any news on this?
astech-mweber3 commentedon Oct 26, 2022
Any news on this? This is really hitting us hard. It's really overdue that the provider utilizes the features introduced several years ago. Are there any plans on moving to the GraphQL API?
kfcampbell commentedon Oct 27, 2022
@spr-mweber3 are there particular resources you'd like to see the GraphQL API used in? We're using it in a number of places so far.
astech-mweber3 commentedon Oct 31, 2022
@kfcampbell, yes sure. I'm particularly interested in having the resource
github_repository_fileimplement that. Currently we're doing quite a lot with it and are hitting the rate limit quickly because every file is read/committed separately. It's just a waste of API calls the way this functionality is currently implemented in the provider.kfcampbell commentedon Oct 31, 2022
Is that behavior you might be interested in submitting a PR to change?
astech-mweber3 commentedon Nov 14, 2022
@nickfloyd @kfcampbell Sorry for the late response, guys. Unfortunately neither time nor skills provide that I fix this in a PR. Not my area of expertise (yet), but I'm happy to see that it already got picked up with high priority. 💯
If I can be of any assistance in shaping the requirements of this feature or any other way, just let me know. I'd be really grateful if the
github_repository_fileresource would be a bit more thrifty in API calls. And I don't think I'm the only one.kfcampbell commentedon Jan 5, 2023
@spr-mweber3 can I talk you into creating an issue for the particular resource(s) you want migrated over to the GraphQL API? I'd like to close this issue as-is, since we're not going to be doing a single PR to cut over every resource the GraphQL API would support.