Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set commit info using create or update #466

Merged
merged 2 commits into from
Jun 9, 2020
Merged

Set commit info using create or update #466

merged 2 commits into from
Jun 9, 2020

Conversation

shoekstra
Copy link
Contributor

Due to how the read func was written Terraform will try to find the commit info each time it does a refresh. As you cannot get this info easily from the GitHub API, the provider would loop through commits until it found one containing the file in question. When the commit is a a distant memory, it can incur many API requests and, when managing many files across many repositories, could result in being rate limited.

To address this instead we now set this info when the file is created or updated and not during the refresh. This is pretty safe as for this info to change upstream it would mean changing the file contents, which would trigger Terraform to update the file again (to enforce desired state).

Due to how the read func was written Terraform will try to find the
commit info each time it does a refresh. As you cannot get this info
easily from the GitHub API, the provider would loop through commits
until it found one containing the file in question. When the commit is a
a distant memory, it can incur many API requests and, when managing many
files across many repositories, could result in being rate limited.

To address this instead we now set this info when the file is created or
updated and not during the refresh. This is pretty safe as for this info
to change upstream it would mean changing the file contents, which would
trigger Terraform to update the file again (to enforce desired state).

Signed-off-by: Stephen Hoekstra <[email protected]>
@ghost ghost added the size/M label May 18, 2020
Signed-off-by: Stephen Hoekstra <[email protected]>
Copy link
Contributor

@jcudit jcudit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. A future improvement could be a GraphQL query, but I do not understand it well enough yet to provide guidance.

@jcudit jcudit added this to the v2.8.1 milestone Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants