experimental: what if - interceptors #316
Open
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.
Description
The ongoing
experimentaltheme: I "think" by trying things & sharing them 😃This pull request proposes a way for a logical provider to "intercept" a request and return a modified context.
As an example, we'll consider a combined SDK+Framework provider, with a List Resource in the Framework logical provider and a Resource in the SDK logical provider. When mux handles a
ListResourcerequest, the SDK provider's interceptor will decorate the context with Resource "stuff" – a schema map or even aschema.Resource.Example: hashicorp/terraform-provider-azurerm#30122 (draft)
The List Resource in the Framework logical provider can use this Resource "stuff" to interact with existing provider logic.
Example: server_listresource_tfprotov5_test.go#L80-L82 (draft)
And mux and Framework remain blissfully decoupled from SDK.
I've borrowed the name "interceptors" from gRPC.
cc: @stephybun
Rollback Plan
Changes to Security Controls
None.