Skip to content

Commit e9ef829

Browse files
committed
unalias tfprotov5 package
1 parent 6dcd682 commit e9ef829

File tree

10 files changed

+231
-231
lines changed

10 files changed

+231
-231
lines changed

helper/resource/plugin.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import (
1111

1212
"github.com/hashicorp/go-hclog"
1313
"github.com/hashicorp/terraform-exec/tfexec"
14-
proto "github.com/hashicorp/terraform-plugin-go/tfprotov5"
14+
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
1515
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
1616
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1717
"github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest"
1818
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
1919
testing "github.com/mitchellh/go-testing-interface"
2020
)
2121

22-
func runProviderCommand(t testing.T, f func() error, wd *plugintest.WorkingDir, factories map[string]func() (*schema.Provider, error), v5factories map[string]func() (proto.ProviderServer, error)) error {
22+
func runProviderCommand(t testing.T, f func() error, wd *plugintest.WorkingDir, factories map[string]func() (*schema.Provider, error), v5factories map[string]func() (tfprotov5.ProviderServer, error)) error {
2323
// don't point to this as a test failure location
2424
// point to whatever called it
2525
t.Helper()
@@ -75,7 +75,7 @@ func runProviderCommand(t testing.T, f func() error, wd *plugintest.WorkingDir,
7575
// into a gRPC interface, and the logger just discards logs
7676
// from go-plugin.
7777
opts := &plugin.ServeOpts{
78-
GRPCProviderFunc: func() proto.ProviderServer {
78+
GRPCProviderFunc: func() tfprotov5.ProviderServer {
7979
return schema.NewGRPCProviderServer(provider)
8080
},
8181
Logger: hclog.New(&hclog.LoggerOptions{
@@ -154,7 +154,7 @@ func runProviderCommand(t testing.T, f func() error, wd *plugintest.WorkingDir,
154154
// into a gRPC interface, and the logger just discards logs
155155
// from go-plugin.
156156
opts := &plugin.ServeOpts{
157-
GRPCProviderFunc: func() proto.ProviderServer {
157+
GRPCProviderFunc: func() tfprotov5.ProviderServer {
158158
return provider
159159
},
160160
Logger: hclog.New(&hclog.LoggerOptions{

helper/resource/testing.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/hashicorp/go-multierror"
1414
testing "github.com/mitchellh/go-testing-interface"
1515

16-
proto "github.com/hashicorp/terraform-plugin-go/tfprotov5"
16+
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
1717
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
1818
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1919
"github.com/hashicorp/terraform-plugin-sdk/v2/internal/addrs"
@@ -300,7 +300,7 @@ type TestCase struct {
300300
// ProtoV5ProviderFactories serves the same purpose as ProviderFactories,
301301
// but for protocol v5 providers defined using the terraform-plugin-go
302302
// ProviderServer interface.
303-
ProtoV5ProviderFactories map[string]func() (proto.ProviderServer, error)
303+
ProtoV5ProviderFactories map[string]func() (tfprotov5.ProviderServer, error)
304304

305305
// Providers is the ResourceProvider that will be under test.
306306
//

helper/resource/testing_new.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import (
1010
tfjson "github.com/hashicorp/terraform-json"
1111
testing "github.com/mitchellh/go-testing-interface"
1212

13-
proto "github.com/hashicorp/terraform-plugin-go/tfprotov5"
13+
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
1414
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1515
"github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest"
1616
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
1717
)
1818

19-
func runPostTestDestroy(t testing.T, c TestCase, wd *plugintest.WorkingDir, factories map[string]func() (*schema.Provider, error), v5factories map[string]func() (proto.ProviderServer, error), statePreDestroy *terraform.State) error {
19+
func runPostTestDestroy(t testing.T, c TestCase, wd *plugintest.WorkingDir, factories map[string]func() (*schema.Provider, error), v5factories map[string]func() (tfprotov5.ProviderServer, error), statePreDestroy *terraform.State) error {
2020
t.Helper()
2121

2222
err := runProviderCommand(t, func() error {

helper/schema/grpc_provider.go

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
ctyconvert "github.com/hashicorp/go-cty/cty/convert"
1313
"github.com/hashicorp/go-cty/cty/msgpack"
1414

15-
proto "github.com/hashicorp/terraform-plugin-go/tfprotov5"
15+
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
1616
"github.com/hashicorp/terraform-plugin-go/tfprotov5/tftypes"
1717
"github.com/hashicorp/terraform-plugin-sdk/v2/internal/configs/configschema"
1818
"github.com/hashicorp/terraform-plugin-sdk/v2/internal/configs/hcl2shim"
@@ -61,30 +61,30 @@ func (s *GRPCProviderServer) StopContext(ctx context.Context) context.Context {
6161
return stoppable
6262
}
6363

64-
func (s *GRPCProviderServer) GetProviderSchema(_ context.Context, req *proto.GetProviderSchemaRequest) (*proto.GetProviderSchemaResponse, error) {
64+
func (s *GRPCProviderServer) GetProviderSchema(_ context.Context, req *tfprotov5.GetProviderSchemaRequest) (*tfprotov5.GetProviderSchemaResponse, error) {
6565

66-
resp := &proto.GetProviderSchemaResponse{
67-
ResourceSchemas: make(map[string]*proto.Schema),
68-
DataSourceSchemas: make(map[string]*proto.Schema),
66+
resp := &tfprotov5.GetProviderSchemaResponse{
67+
ResourceSchemas: make(map[string]*tfprotov5.Schema),
68+
DataSourceSchemas: make(map[string]*tfprotov5.Schema),
6969
}
7070

71-
resp.Provider = &proto.Schema{
71+
resp.Provider = &tfprotov5.Schema{
7272
Block: convert.ConfigSchemaToProto(s.getProviderSchemaBlock()),
7373
}
7474

75-
resp.ProviderMeta = &proto.Schema{
75+
resp.ProviderMeta = &tfprotov5.Schema{
7676
Block: convert.ConfigSchemaToProto(s.getProviderMetaSchemaBlock()),
7777
}
7878

7979
for typ, res := range s.provider.ResourcesMap {
80-
resp.ResourceSchemas[typ] = &proto.Schema{
80+
resp.ResourceSchemas[typ] = &tfprotov5.Schema{
8181
Version: int64(res.SchemaVersion),
8282
Block: convert.ConfigSchemaToProto(res.CoreConfigSchema()),
8383
}
8484
}
8585

8686
for typ, dat := range s.provider.DataSourcesMap {
87-
resp.DataSourceSchemas[typ] = &proto.Schema{
87+
resp.DataSourceSchemas[typ] = &tfprotov5.Schema{
8888
Version: int64(dat.SchemaVersion),
8989
Block: convert.ConfigSchemaToProto(dat.CoreConfigSchema()),
9090
}
@@ -111,8 +111,8 @@ func (s *GRPCProviderServer) getDatasourceSchemaBlock(name string) *configschema
111111
return dat.CoreConfigSchema()
112112
}
113113

114-
func (s *GRPCProviderServer) PrepareProviderConfig(_ context.Context, req *proto.PrepareProviderConfigRequest) (*proto.PrepareProviderConfigResponse, error) {
115-
resp := &proto.PrepareProviderConfigResponse{}
114+
func (s *GRPCProviderServer) PrepareProviderConfig(_ context.Context, req *tfprotov5.PrepareProviderConfigRequest) (*tfprotov5.PrepareProviderConfigResponse, error) {
115+
resp := &tfprotov5.PrepareProviderConfigResponse{}
116116

117117
schemaBlock := s.getProviderSchemaBlock()
118118

@@ -209,13 +209,13 @@ func (s *GRPCProviderServer) PrepareProviderConfig(_ context.Context, req *proto
209209
return resp, nil
210210
}
211211

212-
resp.PreparedConfig = &proto.DynamicValue{MsgPack: preparedConfigMP}
212+
resp.PreparedConfig = &tfprotov5.DynamicValue{MsgPack: preparedConfigMP}
213213

214214
return resp, nil
215215
}
216216

217-
func (s *GRPCProviderServer) ValidateResourceTypeConfig(_ context.Context, req *proto.ValidateResourceTypeConfigRequest) (*proto.ValidateResourceTypeConfigResponse, error) {
218-
resp := &proto.ValidateResourceTypeConfigResponse{}
217+
func (s *GRPCProviderServer) ValidateResourceTypeConfig(_ context.Context, req *tfprotov5.ValidateResourceTypeConfigRequest) (*tfprotov5.ValidateResourceTypeConfigResponse, error) {
218+
resp := &tfprotov5.ValidateResourceTypeConfigResponse{}
219219

220220
schemaBlock := s.getResourceSchemaBlock(req.TypeName)
221221

@@ -232,8 +232,8 @@ func (s *GRPCProviderServer) ValidateResourceTypeConfig(_ context.Context, req *
232232
return resp, nil
233233
}
234234

235-
func (s *GRPCProviderServer) ValidateDataSourceConfig(_ context.Context, req *proto.ValidateDataSourceConfigRequest) (*proto.ValidateDataSourceConfigResponse, error) {
236-
resp := &proto.ValidateDataSourceConfigResponse{}
235+
func (s *GRPCProviderServer) ValidateDataSourceConfig(_ context.Context, req *tfprotov5.ValidateDataSourceConfigRequest) (*tfprotov5.ValidateDataSourceConfigResponse, error) {
236+
resp := &tfprotov5.ValidateDataSourceConfigResponse{}
237237

238238
schemaBlock := s.getDatasourceSchemaBlock(req.TypeName)
239239

@@ -256,8 +256,8 @@ func (s *GRPCProviderServer) ValidateDataSourceConfig(_ context.Context, req *pr
256256
return resp, nil
257257
}
258258

259-
func (s *GRPCProviderServer) UpgradeResourceState(ctx context.Context, req *proto.UpgradeResourceStateRequest) (*proto.UpgradeResourceStateResponse, error) {
260-
resp := &proto.UpgradeResourceStateResponse{}
259+
func (s *GRPCProviderServer) UpgradeResourceState(ctx context.Context, req *tfprotov5.UpgradeResourceStateRequest) (*tfprotov5.UpgradeResourceStateResponse, error) {
260+
resp := &tfprotov5.UpgradeResourceStateResponse{}
261261

262262
res, ok := s.provider.ResourcesMap[req.TypeName]
263263
if !ok {
@@ -328,7 +328,7 @@ func (s *GRPCProviderServer) UpgradeResourceState(ctx context.Context, req *prot
328328
return resp, nil
329329
}
330330

331-
resp.UpgradedState = &proto.DynamicValue{MsgPack: newStateMP}
331+
resp.UpgradedState = &tfprotov5.DynamicValue{MsgPack: newStateMP}
332332
return resp, nil
333333
}
334334

@@ -478,7 +478,7 @@ func (s *GRPCProviderServer) removeAttributes(v interface{}, ty cty.Type) {
478478
}
479479
}
480480

481-
func (s *GRPCProviderServer) StopProvider(_ context.Context, _ *proto.StopProviderRequest) (*proto.StopProviderResponse, error) {
481+
func (s *GRPCProviderServer) StopProvider(_ context.Context, _ *tfprotov5.StopProviderRequest) (*tfprotov5.StopProviderResponse, error) {
482482
s.stopMu.Lock()
483483
defer s.stopMu.Unlock()
484484

@@ -487,11 +487,11 @@ func (s *GRPCProviderServer) StopProvider(_ context.Context, _ *proto.StopProvid
487487
// reset the stop signal
488488
s.stopCh = make(chan struct{})
489489

490-
return &proto.StopProviderResponse{}, nil
490+
return &tfprotov5.StopProviderResponse{}, nil
491491
}
492492

493-
func (s *GRPCProviderServer) ConfigureProvider(ctx context.Context, req *proto.ConfigureProviderRequest) (*proto.ConfigureProviderResponse, error) {
494-
resp := &proto.ConfigureProviderResponse{}
493+
func (s *GRPCProviderServer) ConfigureProvider(ctx context.Context, req *tfprotov5.ConfigureProviderRequest) (*tfprotov5.ConfigureProviderResponse, error) {
494+
resp := &tfprotov5.ConfigureProviderResponse{}
495495

496496
schemaBlock := s.getProviderSchemaBlock()
497497

@@ -522,8 +522,8 @@ func (s *GRPCProviderServer) ConfigureProvider(ctx context.Context, req *proto.C
522522
return resp, nil
523523
}
524524

525-
func (s *GRPCProviderServer) ReadResource(ctx context.Context, req *proto.ReadResourceRequest) (*proto.ReadResourceResponse, error) {
526-
resp := &proto.ReadResourceResponse{
525+
func (s *GRPCProviderServer) ReadResource(ctx context.Context, req *tfprotov5.ReadResourceRequest) (*tfprotov5.ReadResourceResponse, error) {
526+
resp := &tfprotov5.ReadResourceResponse{
527527
// helper/schema did previously handle private data during refresh, but
528528
// core is now going to expect this to be maintained in order to
529529
// persist it in the state.
@@ -582,7 +582,7 @@ func (s *GRPCProviderServer) ReadResource(ctx context.Context, req *proto.ReadRe
582582
if err != nil {
583583
resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err)
584584
}
585-
resp.NewState = &proto.DynamicValue{
585+
resp.NewState = &tfprotov5.DynamicValue{
586586
MsgPack: newStateMP,
587587
}
588588
return resp, nil
@@ -606,15 +606,15 @@ func (s *GRPCProviderServer) ReadResource(ctx context.Context, req *proto.ReadRe
606606
return resp, nil
607607
}
608608

609-
resp.NewState = &proto.DynamicValue{
609+
resp.NewState = &tfprotov5.DynamicValue{
610610
MsgPack: newStateMP,
611611
}
612612

613613
return resp, nil
614614
}
615615

616-
func (s *GRPCProviderServer) PlanResourceChange(ctx context.Context, req *proto.PlanResourceChangeRequest) (*proto.PlanResourceChangeResponse, error) {
617-
resp := &proto.PlanResourceChangeResponse{}
616+
func (s *GRPCProviderServer) PlanResourceChange(ctx context.Context, req *tfprotov5.PlanResourceChangeRequest) (*tfprotov5.PlanResourceChangeResponse, error) {
617+
resp := &tfprotov5.PlanResourceChangeResponse{}
618618

619619
// This is a signal to Terraform Core that we're doing the best we can to
620620
// shim the legacy type system of the SDK onto the Terraform type system
@@ -766,7 +766,7 @@ func (s *GRPCProviderServer) PlanResourceChange(ctx context.Context, req *proto.
766766
resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err)
767767
return resp, nil
768768
}
769-
resp.PlannedState = &proto.DynamicValue{
769+
resp.PlannedState = &tfprotov5.DynamicValue{
770770
MsgPack: plannedMP,
771771
}
772772

@@ -840,8 +840,8 @@ func (s *GRPCProviderServer) PlanResourceChange(ctx context.Context, req *proto.
840840
return resp, nil
841841
}
842842

843-
func (s *GRPCProviderServer) ApplyResourceChange(ctx context.Context, req *proto.ApplyResourceChangeRequest) (*proto.ApplyResourceChangeResponse, error) {
844-
resp := &proto.ApplyResourceChangeResponse{
843+
func (s *GRPCProviderServer) ApplyResourceChange(ctx context.Context, req *tfprotov5.ApplyResourceChangeRequest) (*tfprotov5.ApplyResourceChangeResponse, error) {
844+
resp := &tfprotov5.ApplyResourceChangeResponse{
845845
// Start with the existing state as a fallback
846846
NewState: req.PriorState,
847847
}
@@ -962,7 +962,7 @@ func (s *GRPCProviderServer) ApplyResourceChange(ctx context.Context, req *proto
962962
resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err)
963963
return resp, nil
964964
}
965-
resp.NewState = &proto.DynamicValue{
965+
resp.NewState = &tfprotov5.DynamicValue{
966966
MsgPack: newStateMP,
967967
}
968968
return resp, nil
@@ -985,7 +985,7 @@ func (s *GRPCProviderServer) ApplyResourceChange(ctx context.Context, req *proto
985985
resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err)
986986
return resp, nil
987987
}
988-
resp.NewState = &proto.DynamicValue{
988+
resp.NewState = &tfprotov5.DynamicValue{
989989
MsgPack: newStateMP,
990990
}
991991

@@ -1007,8 +1007,8 @@ func (s *GRPCProviderServer) ApplyResourceChange(ctx context.Context, req *proto
10071007
return resp, nil
10081008
}
10091009

1010-
func (s *GRPCProviderServer) ImportResourceState(ctx context.Context, req *proto.ImportResourceStateRequest) (*proto.ImportResourceStateResponse, error) {
1011-
resp := &proto.ImportResourceStateResponse{}
1010+
func (s *GRPCProviderServer) ImportResourceState(ctx context.Context, req *tfprotov5.ImportResourceStateRequest) (*tfprotov5.ImportResourceStateResponse, error) {
1011+
resp := &tfprotov5.ImportResourceStateResponse{}
10121012

10131013
info := &terraform.InstanceInfo{
10141014
Type: req.TypeName,
@@ -1051,9 +1051,9 @@ func (s *GRPCProviderServer) ImportResourceState(ctx context.Context, req *proto
10511051
return resp, nil
10521052
}
10531053

1054-
importedResource := &proto.ImportedResource{
1054+
importedResource := &tfprotov5.ImportedResource{
10551055
TypeName: resourceType,
1056-
State: &proto.DynamicValue{
1056+
State: &tfprotov5.DynamicValue{
10571057
MsgPack: newStateMP,
10581058
},
10591059
Private: meta,
@@ -1065,8 +1065,8 @@ func (s *GRPCProviderServer) ImportResourceState(ctx context.Context, req *proto
10651065
return resp, nil
10661066
}
10671067

1068-
func (s *GRPCProviderServer) ReadDataSource(ctx context.Context, req *proto.ReadDataSourceRequest) (*proto.ReadDataSourceResponse, error) {
1069-
resp := &proto.ReadDataSourceResponse{}
1068+
func (s *GRPCProviderServer) ReadDataSource(ctx context.Context, req *tfprotov5.ReadDataSourceRequest) (*tfprotov5.ReadDataSourceResponse, error) {
1069+
resp := &tfprotov5.ReadDataSourceResponse{}
10701070

10711071
schemaBlock := s.getDatasourceSchemaBlock(req.TypeName)
10721072

@@ -1117,7 +1117,7 @@ func (s *GRPCProviderServer) ReadDataSource(ctx context.Context, req *proto.Read
11171117
resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err)
11181118
return resp, nil
11191119
}
1120-
resp.State = &proto.DynamicValue{
1120+
resp.State = &tfprotov5.DynamicValue{
11211121
MsgPack: newStateMP,
11221122
}
11231123
return resp, nil
@@ -1404,8 +1404,8 @@ func normalizeNullValues(dst, src cty.Value, apply bool) cty.Value {
14041404
// appears in a list-like attribute (list, set, tuple) will present a nil value
14051405
// to helper/schema which can panic. Return an error to the user in this case,
14061406
// indicating the attribute with the null value.
1407-
func validateConfigNulls(v cty.Value, path cty.Path) []*proto.Diagnostic {
1408-
var diags []*proto.Diagnostic
1407+
func validateConfigNulls(v cty.Value, path cty.Path) []*tfprotov5.Diagnostic {
1408+
var diags []*tfprotov5.Diagnostic
14091409
if v.IsNull() || !v.IsKnown() {
14101410
return diags
14111411
}
@@ -1424,8 +1424,8 @@ func validateConfigNulls(v cty.Value, path cty.Path) []*proto.Diagnostic {
14241424
p = append(p, cty.IndexStep{Key: kv})
14251425
}
14261426

1427-
diags = append(diags, &proto.Diagnostic{
1428-
Severity: proto.DiagnosticSeverityError,
1427+
diags = append(diags, &tfprotov5.Diagnostic{
1428+
Severity: tfprotov5.DiagnosticSeverityError,
14291429
Summary: "Null value found in list",
14301430
Detail: "Null values are not allowed for this attribute value.",
14311431
Attribute: convert.PathToAttributePath(p),

0 commit comments

Comments
 (0)