@@ -12,7 +12,7 @@ import (
12
12
ctyconvert "github.com/hashicorp/go-cty/cty/convert"
13
13
"github.com/hashicorp/go-cty/cty/msgpack"
14
14
15
- proto "github.com/hashicorp/terraform-plugin-go/tfprotov5"
15
+ "github.com/hashicorp/terraform-plugin-go/tfprotov5"
16
16
"github.com/hashicorp/terraform-plugin-go/tfprotov5/tftypes"
17
17
"github.com/hashicorp/terraform-plugin-sdk/v2/internal/configs/configschema"
18
18
"github.com/hashicorp/terraform-plugin-sdk/v2/internal/configs/hcl2shim"
@@ -61,30 +61,30 @@ func (s *GRPCProviderServer) StopContext(ctx context.Context) context.Context {
61
61
return stoppable
62
62
}
63
63
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 ) {
65
65
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 ),
69
69
}
70
70
71
- resp .Provider = & proto .Schema {
71
+ resp .Provider = & tfprotov5 .Schema {
72
72
Block : convert .ConfigSchemaToProto (s .getProviderSchemaBlock ()),
73
73
}
74
74
75
- resp .ProviderMeta = & proto .Schema {
75
+ resp .ProviderMeta = & tfprotov5 .Schema {
76
76
Block : convert .ConfigSchemaToProto (s .getProviderMetaSchemaBlock ()),
77
77
}
78
78
79
79
for typ , res := range s .provider .ResourcesMap {
80
- resp .ResourceSchemas [typ ] = & proto .Schema {
80
+ resp .ResourceSchemas [typ ] = & tfprotov5 .Schema {
81
81
Version : int64 (res .SchemaVersion ),
82
82
Block : convert .ConfigSchemaToProto (res .CoreConfigSchema ()),
83
83
}
84
84
}
85
85
86
86
for typ , dat := range s .provider .DataSourcesMap {
87
- resp .DataSourceSchemas [typ ] = & proto .Schema {
87
+ resp .DataSourceSchemas [typ ] = & tfprotov5 .Schema {
88
88
Version : int64 (dat .SchemaVersion ),
89
89
Block : convert .ConfigSchemaToProto (dat .CoreConfigSchema ()),
90
90
}
@@ -111,8 +111,8 @@ func (s *GRPCProviderServer) getDatasourceSchemaBlock(name string) *configschema
111
111
return dat .CoreConfigSchema ()
112
112
}
113
113
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 {}
116
116
117
117
schemaBlock := s .getProviderSchemaBlock ()
118
118
@@ -209,13 +209,13 @@ func (s *GRPCProviderServer) PrepareProviderConfig(_ context.Context, req *proto
209
209
return resp , nil
210
210
}
211
211
212
- resp .PreparedConfig = & proto .DynamicValue {MsgPack : preparedConfigMP }
212
+ resp .PreparedConfig = & tfprotov5 .DynamicValue {MsgPack : preparedConfigMP }
213
213
214
214
return resp , nil
215
215
}
216
216
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 {}
219
219
220
220
schemaBlock := s .getResourceSchemaBlock (req .TypeName )
221
221
@@ -232,8 +232,8 @@ func (s *GRPCProviderServer) ValidateResourceTypeConfig(_ context.Context, req *
232
232
return resp , nil
233
233
}
234
234
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 {}
237
237
238
238
schemaBlock := s .getDatasourceSchemaBlock (req .TypeName )
239
239
@@ -256,8 +256,8 @@ func (s *GRPCProviderServer) ValidateDataSourceConfig(_ context.Context, req *pr
256
256
return resp , nil
257
257
}
258
258
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 {}
261
261
262
262
res , ok := s .provider .ResourcesMap [req .TypeName ]
263
263
if ! ok {
@@ -328,7 +328,7 @@ func (s *GRPCProviderServer) UpgradeResourceState(ctx context.Context, req *prot
328
328
return resp , nil
329
329
}
330
330
331
- resp .UpgradedState = & proto .DynamicValue {MsgPack : newStateMP }
331
+ resp .UpgradedState = & tfprotov5 .DynamicValue {MsgPack : newStateMP }
332
332
return resp , nil
333
333
}
334
334
@@ -478,7 +478,7 @@ func (s *GRPCProviderServer) removeAttributes(v interface{}, ty cty.Type) {
478
478
}
479
479
}
480
480
481
- func (s * GRPCProviderServer ) StopProvider (_ context.Context , _ * proto .StopProviderRequest ) (* proto .StopProviderResponse , error ) {
481
+ func (s * GRPCProviderServer ) StopProvider (_ context.Context , _ * tfprotov5 .StopProviderRequest ) (* tfprotov5 .StopProviderResponse , error ) {
482
482
s .stopMu .Lock ()
483
483
defer s .stopMu .Unlock ()
484
484
@@ -487,11 +487,11 @@ func (s *GRPCProviderServer) StopProvider(_ context.Context, _ *proto.StopProvid
487
487
// reset the stop signal
488
488
s .stopCh = make (chan struct {})
489
489
490
- return & proto .StopProviderResponse {}, nil
490
+ return & tfprotov5 .StopProviderResponse {}, nil
491
491
}
492
492
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 {}
495
495
496
496
schemaBlock := s .getProviderSchemaBlock ()
497
497
@@ -522,8 +522,8 @@ func (s *GRPCProviderServer) ConfigureProvider(ctx context.Context, req *proto.C
522
522
return resp , nil
523
523
}
524
524
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 {
527
527
// helper/schema did previously handle private data during refresh, but
528
528
// core is now going to expect this to be maintained in order to
529
529
// persist it in the state.
@@ -582,7 +582,7 @@ func (s *GRPCProviderServer) ReadResource(ctx context.Context, req *proto.ReadRe
582
582
if err != nil {
583
583
resp .Diagnostics = convert .AppendProtoDiag (resp .Diagnostics , err )
584
584
}
585
- resp .NewState = & proto .DynamicValue {
585
+ resp .NewState = & tfprotov5 .DynamicValue {
586
586
MsgPack : newStateMP ,
587
587
}
588
588
return resp , nil
@@ -606,15 +606,15 @@ func (s *GRPCProviderServer) ReadResource(ctx context.Context, req *proto.ReadRe
606
606
return resp , nil
607
607
}
608
608
609
- resp .NewState = & proto .DynamicValue {
609
+ resp .NewState = & tfprotov5 .DynamicValue {
610
610
MsgPack : newStateMP ,
611
611
}
612
612
613
613
return resp , nil
614
614
}
615
615
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 {}
618
618
619
619
// This is a signal to Terraform Core that we're doing the best we can to
620
620
// 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.
766
766
resp .Diagnostics = convert .AppendProtoDiag (resp .Diagnostics , err )
767
767
return resp , nil
768
768
}
769
- resp .PlannedState = & proto .DynamicValue {
769
+ resp .PlannedState = & tfprotov5 .DynamicValue {
770
770
MsgPack : plannedMP ,
771
771
}
772
772
@@ -840,8 +840,8 @@ func (s *GRPCProviderServer) PlanResourceChange(ctx context.Context, req *proto.
840
840
return resp , nil
841
841
}
842
842
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 {
845
845
// Start with the existing state as a fallback
846
846
NewState : req .PriorState ,
847
847
}
@@ -962,7 +962,7 @@ func (s *GRPCProviderServer) ApplyResourceChange(ctx context.Context, req *proto
962
962
resp .Diagnostics = convert .AppendProtoDiag (resp .Diagnostics , err )
963
963
return resp , nil
964
964
}
965
- resp .NewState = & proto .DynamicValue {
965
+ resp .NewState = & tfprotov5 .DynamicValue {
966
966
MsgPack : newStateMP ,
967
967
}
968
968
return resp , nil
@@ -985,7 +985,7 @@ func (s *GRPCProviderServer) ApplyResourceChange(ctx context.Context, req *proto
985
985
resp .Diagnostics = convert .AppendProtoDiag (resp .Diagnostics , err )
986
986
return resp , nil
987
987
}
988
- resp .NewState = & proto .DynamicValue {
988
+ resp .NewState = & tfprotov5 .DynamicValue {
989
989
MsgPack : newStateMP ,
990
990
}
991
991
@@ -1007,8 +1007,8 @@ func (s *GRPCProviderServer) ApplyResourceChange(ctx context.Context, req *proto
1007
1007
return resp , nil
1008
1008
}
1009
1009
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 {}
1012
1012
1013
1013
info := & terraform.InstanceInfo {
1014
1014
Type : req .TypeName ,
@@ -1051,9 +1051,9 @@ func (s *GRPCProviderServer) ImportResourceState(ctx context.Context, req *proto
1051
1051
return resp , nil
1052
1052
}
1053
1053
1054
- importedResource := & proto .ImportedResource {
1054
+ importedResource := & tfprotov5 .ImportedResource {
1055
1055
TypeName : resourceType ,
1056
- State : & proto .DynamicValue {
1056
+ State : & tfprotov5 .DynamicValue {
1057
1057
MsgPack : newStateMP ,
1058
1058
},
1059
1059
Private : meta ,
@@ -1065,8 +1065,8 @@ func (s *GRPCProviderServer) ImportResourceState(ctx context.Context, req *proto
1065
1065
return resp , nil
1066
1066
}
1067
1067
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 {}
1070
1070
1071
1071
schemaBlock := s .getDatasourceSchemaBlock (req .TypeName )
1072
1072
@@ -1117,7 +1117,7 @@ func (s *GRPCProviderServer) ReadDataSource(ctx context.Context, req *proto.Read
1117
1117
resp .Diagnostics = convert .AppendProtoDiag (resp .Diagnostics , err )
1118
1118
return resp , nil
1119
1119
}
1120
- resp .State = & proto .DynamicValue {
1120
+ resp .State = & tfprotov5 .DynamicValue {
1121
1121
MsgPack : newStateMP ,
1122
1122
}
1123
1123
return resp , nil
@@ -1404,8 +1404,8 @@ func normalizeNullValues(dst, src cty.Value, apply bool) cty.Value {
1404
1404
// appears in a list-like attribute (list, set, tuple) will present a nil value
1405
1405
// to helper/schema which can panic. Return an error to the user in this case,
1406
1406
// 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
1409
1409
if v .IsNull () || ! v .IsKnown () {
1410
1410
return diags
1411
1411
}
@@ -1424,8 +1424,8 @@ func validateConfigNulls(v cty.Value, path cty.Path) []*proto.Diagnostic {
1424
1424
p = append (p , cty.IndexStep {Key : kv })
1425
1425
}
1426
1426
1427
- diags = append (diags , & proto .Diagnostic {
1428
- Severity : proto .DiagnosticSeverityError ,
1427
+ diags = append (diags , & tfprotov5 .Diagnostic {
1428
+ Severity : tfprotov5 .DiagnosticSeverityError ,
1429
1429
Summary : "Null value found in list" ,
1430
1430
Detail : "Null values are not allowed for this attribute value." ,
1431
1431
Attribute : convert .PathToAttributePath (p ),
0 commit comments