Skip to content

Commit 6a6f19c

Browse files
committed
Updated Configure to be resource instead of List
1 parent 710ed93 commit 6a6f19c

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

internal/fwserver/server_validatelistresourceconfig.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/hashicorp/terraform-plugin-framework/diag"
99
"github.com/hashicorp/terraform-plugin-framework/internal/logging"
1010
"github.com/hashicorp/terraform-plugin-framework/list"
11+
"github.com/hashicorp/terraform-plugin-framework/resource"
1112
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
1213
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
1314
)
@@ -34,10 +35,10 @@ func (s *Server) ValidateListResourceConfig(ctx context.Context, req *ValidateLi
3435
if listResourceWithConfigure, ok := req.ListResource.(list.ListResourceWithConfigure); ok {
3536
logging.FrameworkTrace(ctx, "ListResource implements ListResourceWithConfigure")
3637

37-
configureReq := list.ConfigureRequest{
38+
configureReq := resource.ConfigureRequest{
3839
ProviderData: s.ListResourceConfigureData,
3940
}
40-
configureResp := list.ConfigureResponse{}
41+
configureResp := resource.ConfigureResponse{}
4142

4243
logging.FrameworkTrace(ctx, "Calling provider defined ListResource Configure")
4344
listResourceWithConfigure.Configure(ctx, configureReq, &configureResp)

internal/testing/testprovider/listresourcewithconfigure.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package testprovider
55

66
import (
77
"context"
8+
"github.com/hashicorp/terraform-plugin-framework/resource"
89

910
"github.com/hashicorp/terraform-plugin-framework/list"
1011
)
@@ -17,11 +18,11 @@ type ListResourceWithConfigure struct {
1718
*ListResource
1819

1920
// ListResourceWithConfigure interface methods
20-
ConfigureMethod func(context.Context, list.ConfigureRequest, *list.ConfigureResponse)
21+
ConfigureMethod func(context.Context, resource.ConfigureRequest, *resource.ConfigureResponse)
2122
}
2223

2324
// Configure satisfies the list.ListResourceWithConfigure interface.
24-
func (d *ListResourceWithConfigure) Configure(ctx context.Context, req list.ConfigureRequest, resp *list.ConfigureResponse) {
25+
func (d *ListResourceWithConfigure) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
2526
if d.ConfigureMethod == nil {
2627
return
2728
}

list/list_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type ListResourceWithConfigure interface {
5050
// signature is intended to be compatible with the Configure method
5151
// signature in the Resource interface. One implementation of Configure can
5252
// satisfy both interfaces.
53-
Configure(context.Context, ConfigureRequest, *ConfigureResponse)
53+
Configure(context.Context, resource.ConfigureRequest, *resource.ConfigureResponse)
5454
}
5555

5656
// ListResourceWithConfigValidators is an interface type that extends

list/list_resource_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type ComputeInstanceWithListResourceConfigValidators struct {
2323
ComputeInstanceResource
2424
}
2525

26-
func (c *ComputeInstanceResource) Configure(_ context.Context, _ list.ConfigureRequest, _ *list.ConfigureResponse) {
26+
func (c *ComputeInstanceResource) Configure(_ context.Context, _ resource.ConfigureRequest, _ *resource.ConfigureResponse) {
2727
}
2828

2929
func (c *ComputeInstanceResource) Metadata(_ context.Context, _ resource.MetadataRequest, _ *resource.MetadataResponse) {

0 commit comments

Comments
 (0)