fix: Use ETag when reading github_branch_default
resources.
#1994
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This resource was missing saving and using the underlying resource's ETag. This was discovered when we were hitting over-quota errors via this resource.
The etag related implementation was copied from the
github_repository
implementation.Aside: There could be some refactoring to have these resources share some common code. Such a refactoring seemed outside the scope of this change.
Resolves #1993
Before the change?
github_branch_default
would use one request per resource read.After the change?
github_branch_default
should only consume quota when there is drift in the plan.Pull request checklist
Note: It didn't look like there were any existing tests validating the etag behaviors. If tests are desired for this feature, a pointer to an example would be appreciated, or a rough sketch if none exists. Any guidance would be appreciated.
Note: Not all resources which implement the etag feature have the field documented. The field feels like an internal implementation detail which wouldn't normally be documented. Given the repo is inconsistent, guidance on if the field should be documented or not would be appreciated.
Does this introduce a breaking change?
Please see our docs on breaking changes to help!