Skip to content

Conversation

@bbasata
Copy link
Contributor

@bbasata bbasata commented Jul 9, 2025

Description

The ongoing experimental theme: 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 ListResource request, the SDK provider's interceptor will decorate the context with Resource "stuff" – a schema map or even a schema.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

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

None.

@bbasata bbasata requested a review from a team as a code owner July 9, 2025 14:29
if i.BeforeListResource == nil {
continue
}
ctx = i.BeforeListResource(ctx, req)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
ctx = i.BeforeListResource(ctx, req)
ctx = i.Before(ctx, ListResource, req)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant