-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[WIP] Simplify Framework registration #43298
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
base: main
Are you sure you want to change the base?
Conversation
Community GuidelinesThis comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀 Voting for Prioritization
Pull Request Authors
|
@@ -35,7 +36,7 @@ import ( | |||
) | |||
|
|||
var ( | |||
resourceSchemasValidated bool | |||
resourceSchemasValidated sync.Once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this returns an error
should we prefer sync.OnceValue
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I thought about that. I see sync.OnceValue
as more "return a useful value", but since the error
manages the control flow, that counts as a "useful value"
} | ||
} | ||
|
||
// bootstrapContext is run on all wrapped methods before any interceptors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just context
(or Context
) is now a better name for this method?
Rollback Plan
If a change needs to be reverted, we will publish an updated version of the library.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
Description
Uses
sync.Once
instead of mutex and boolean to ensure schema validation is called once.Simplifies Framework Data Source registration:
inner
wrapped resource until wrapper is calledboostrapContext
a method onwrappedDataSource
instead of function pointer