Skip to content

Commit 5cfbb54

Browse files
Update terraform-plugin-go and terraform-plugin-sdk (#1551)
Co-authored-by: Alex Somesan <[email protected]>
1 parent b6009a9 commit 5cfbb54

File tree

301 files changed

+18097
-5951
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

301 files changed

+18097
-5951
lines changed

go.mod

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,21 @@ require (
1515
github.com/google/gofuzz v1.2.0 // indirect
1616
github.com/google/uuid v1.2.0 // indirect
1717
github.com/hashicorp/errwrap v1.1.0 // indirect
18-
github.com/hashicorp/go-hclog v0.16.0
19-
github.com/hashicorp/go-multierror v1.1.1 // indirect
20-
github.com/hashicorp/go-plugin v1.4.1
21-
github.com/hashicorp/go-uuid v1.0.2 // indirect
18+
github.com/hashicorp/go-hclog v1.1.0
19+
github.com/hashicorp/go-plugin v1.4.3
2220
github.com/hashicorp/go-version v1.3.0
2321
github.com/hashicorp/hcl/v2 v2.9.1
24-
github.com/hashicorp/terraform-exec v0.14.0
25-
github.com/hashicorp/terraform-json v0.12.0
26-
github.com/hashicorp/terraform-plugin-go v0.3.1
22+
github.com/hashicorp/terraform-exec v0.15.0
23+
github.com/hashicorp/terraform-json v0.13.0
24+
github.com/hashicorp/terraform-plugin-go v0.7.0
2725
github.com/hashicorp/terraform-plugin-mux v0.2.0
28-
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.0
26+
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.0
2927
github.com/hashicorp/terraform-plugin-test/v2 v2.2.1
3028
github.com/hashicorp/yamux v0.0.0-20210316155119-a95892c5f864 // indirect
3129
github.com/jinzhu/copier v0.2.9
3230
github.com/klauspost/compress v1.12.1 // indirect
3331
github.com/mailru/easyjson v0.7.7 // indirect
3432
github.com/mitchellh/go-homedir v1.1.0
35-
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
3633
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
3734
github.com/mitchellh/hashstructure v1.1.0
3835
github.com/mitchellh/mapstructure v1.4.1 // indirect
@@ -43,14 +40,14 @@ require (
4340
github.com/stretchr/testify v1.7.0
4441
github.com/ulikunitz/xz v0.5.10 // indirect
4542
github.com/xlab/treeprint v1.1.0 // indirect
46-
github.com/zclconf/go-cty v1.8.4
43+
github.com/zclconf/go-cty v1.9.1
4744
go.starlark.net v0.0.0-20210406145628-7a1108eaa012 // indirect
4845
golang.org/x/mod v0.4.2
4946
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect
5047
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
5148
golang.org/x/term v0.0.0-20210406210042-72f3dc4e9b72 // indirect
5249
google.golang.org/api v0.44.0 // indirect
53-
google.golang.org/grpc v1.38.0
50+
google.golang.org/grpc v1.43.0
5451
k8s.io/api v0.22.4
5552
k8s.io/apiextensions-apiserver v0.22.4
5653
k8s.io/apimachinery v0.22.4

go.sum

Lines changed: 41 additions & 19 deletions
Large diffs are not rendered by default.

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/hashicorp/go-plugin"
1313
"github.com/hashicorp/terraform-exec/tfexec"
1414
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
15-
tf5server "github.com/hashicorp/terraform-plugin-go/tfprotov5/server"
15+
tf5server "github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server"
1616
tfmux "github.com/hashicorp/terraform-plugin-mux"
1717

1818
"github.com/hashicorp/terraform-provider-kubernetes/kubernetes"

manifest/morph/morph.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func morphListToType(v tftypes.Value, t tftypes.Type, p *tftypes.AttributePath)
117117
case t.Is(tftypes.List{}):
118118
var nlvals []tftypes.Value = make([]tftypes.Value, len(lvals))
119119
for i, v := range lvals {
120-
elp := p.WithElementKeyInt(int64(i))
120+
elp := p.WithElementKeyInt(i)
121121
nv, err := ValueToType(v, t.(tftypes.List).ElementType, elp)
122122
if err != nil {
123123
return tftypes.Value{}, elp.NewErrorf("[%s] failed to morph list element into list element: %v", elp.String(), err)
@@ -131,7 +131,7 @@ func morphListToType(v tftypes.Value, t tftypes.Type, p *tftypes.AttributePath)
131131
}
132132
var tvals []tftypes.Value = make([]tftypes.Value, len(lvals))
133133
for i, v := range lvals {
134-
elp := p.WithElementKeyInt(int64(i))
134+
elp := p.WithElementKeyInt(i)
135135
nv, err := ValueToType(v, t.(tftypes.Tuple).ElementTypes[i], elp)
136136
if err != nil {
137137
return tftypes.Value{}, elp.NewErrorf("[%s] failed to morph list element into tuple element: %v", elp.String(), err)
@@ -142,7 +142,7 @@ func morphListToType(v tftypes.Value, t tftypes.Type, p *tftypes.AttributePath)
142142
case t.Is(tftypes.Set{}):
143143
var svals []tftypes.Value = make([]tftypes.Value, len(lvals))
144144
for i, v := range lvals {
145-
elp := p.WithElementKeyInt(int64(i))
145+
elp := p.WithElementKeyInt(i)
146146
nv, err := ValueToType(v, t.(tftypes.Set).ElementType, elp)
147147
if err != nil {
148148
return tftypes.Value{}, elp.NewErrorf("[%s] failed to morph list element into set element: %v", elp.String(), err)
@@ -180,7 +180,7 @@ func morphTupleIntoType(v tftypes.Value, t tftypes.Type, p *tftypes.AttributePat
180180
}
181181
}
182182
for i, v := range tvals {
183-
elp := p.WithElementKeyInt(int64(i))
183+
elp := p.WithElementKeyInt(i)
184184
nv, err := ValueToType(v, eltypes[i], elp)
185185
if err != nil {
186186
return tftypes.Value{}, elp.NewErrorf("[%s] failed to morph tuple element into tuple element: %v", elp.String(), err)
@@ -191,7 +191,7 @@ func morphTupleIntoType(v tftypes.Value, t tftypes.Type, p *tftypes.AttributePat
191191
case t.Is(tftypes.List{}):
192192
var lvals []tftypes.Value = make([]tftypes.Value, len(tvals))
193193
for i, v := range tvals {
194-
elp := p.WithElementKeyInt(int64(i))
194+
elp := p.WithElementKeyInt(i)
195195
nv, err := ValueToType(v, t.(tftypes.List).ElementType, elp)
196196
if err != nil {
197197
return tftypes.Value{}, elp.NewErrorf("[%s] failed to morph tuple element into list element: %v", elp.String(), err)
@@ -202,7 +202,7 @@ func morphTupleIntoType(v tftypes.Value, t tftypes.Type, p *tftypes.AttributePat
202202
case t.Is(tftypes.Set{}):
203203
var svals []tftypes.Value = make([]tftypes.Value, len(tvals))
204204
for i, v := range tvals {
205-
elp := p.WithElementKeyInt(int64(i))
205+
elp := p.WithElementKeyInt(i)
206206
nv, err := ValueToType(v, t.(tftypes.Set).ElementType, elp)
207207
if err != nil {
208208
return tftypes.Value{}, elp.NewErrorf("[%s] failed to morph tuple element into set element: %v", elp.String(), err)
@@ -226,7 +226,7 @@ func morphSetToType(v tftypes.Value, t tftypes.Type, p *tftypes.AttributePath) (
226226
case t.Is(tftypes.Set{}):
227227
var svals []tftypes.Value = make([]tftypes.Value, len(svals))
228228
for i, v := range svals {
229-
elp := p.WithElementKeyInt(int64(i))
229+
elp := p.WithElementKeyInt(i)
230230
nv, err := ValueToType(v, t.(tftypes.Set).ElementType, elp)
231231
if err != nil {
232232
return tftypes.Value{}, elp.NewErrorf("[%s] failed to morph set element into set element : %v", elp.String(), err)
@@ -237,7 +237,7 @@ func morphSetToType(v tftypes.Value, t tftypes.Type, p *tftypes.AttributePath) (
237237
case t.Is(tftypes.List{}):
238238
var lvals []tftypes.Value = make([]tftypes.Value, len(svals))
239239
for i, v := range svals {
240-
elp := p.WithElementKeyInt(int64(i))
240+
elp := p.WithElementKeyInt(i)
241241
nv, err := ValueToType(v, t.(tftypes.List).ElementType, elp)
242242
if err != nil {
243243
return tftypes.Value{}, elp.NewErrorf("[%s] failed to morph set element into list element : %v", elp.String(), err)
@@ -251,7 +251,7 @@ func morphSetToType(v tftypes.Value, t tftypes.Type, p *tftypes.AttributePath) (
251251
}
252252
var tvals []tftypes.Value = make([]tftypes.Value, len(svals))
253253
for i, v := range svals {
254-
elp := p.WithElementKeyInt(int64(i))
254+
elp := p.WithElementKeyInt(i)
255255
nv, err := ValueToType(v, t.(tftypes.Tuple).ElementTypes[i], elp)
256256
if err != nil {
257257
return tftypes.Value{}, elp.NewErrorf("[%s] failed to morph list element into tuple element: %v", elp.String(), err)
@@ -287,7 +287,7 @@ func morphMapToType(v tftypes.Value, t tftypes.Type, p *tftypes.AttributePath) (
287287
var nmvals map[string]tftypes.Value = make(map[string]tftypes.Value, len(mvals))
288288
for k, v := range mvals {
289289
elp := p.WithElementKeyString(k)
290-
nv, err := ValueToType(v, t.(tftypes.Map).AttributeType, elp)
290+
nv, err := ValueToType(v, t.(tftypes.Map).ElementType, elp)
291291
if err != nil {
292292
return tftypes.Value{}, elp.NewErrorf("[%s] failed to morph object element into map element: %v", elp.String(), err)
293293
}
@@ -333,7 +333,7 @@ func morphObjectToType(v tftypes.Value, t tftypes.Type, p *tftypes.AttributePath
333333
var mvals map[string]tftypes.Value = make(map[string]tftypes.Value, len(vals))
334334
for k, v := range vals {
335335
elp := p.WithElementKeyString(k)
336-
nv, err := ValueToType(v, t.(tftypes.Map).AttributeType, elp)
336+
nv, err := ValueToType(v, t.(tftypes.Map).ElementType, elp)
337337
if err != nil {
338338
return tftypes.Value{}, elp.NewErrorf("[%s] failed to morph object element into map element: %v", elp.String(), err)
339339
}

manifest/morph/morph_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func TestMorphValueToType(t *testing.T) {
233233
},
234234
"map->object": {
235235
In: sampleInType{
236-
V: tftypes.NewValue(tftypes.Map{AttributeType: tftypes.String}, map[string]tftypes.Value{
236+
V: tftypes.NewValue(tftypes.Map{ElementType: tftypes.String}, map[string]tftypes.Value{
237237
"one": tftypes.NewValue(tftypes.String, "foo"),
238238
"two": tftypes.NewValue(tftypes.String, "bar"),
239239
"three": tftypes.NewValue(tftypes.String, "baz"),
@@ -256,14 +256,14 @@ func TestMorphValueToType(t *testing.T) {
256256
},
257257
"map->map": {
258258
In: sampleInType{
259-
V: tftypes.NewValue(tftypes.Map{AttributeType: tftypes.String}, map[string]tftypes.Value{
259+
V: tftypes.NewValue(tftypes.Map{ElementType: tftypes.String}, map[string]tftypes.Value{
260260
"one": tftypes.NewValue(tftypes.String, "foo"),
261261
"two": tftypes.NewValue(tftypes.String, "bar"),
262262
"three": tftypes.NewValue(tftypes.String, "baz"),
263263
}),
264-
T: tftypes.Map{AttributeType: tftypes.String},
264+
T: tftypes.Map{ElementType: tftypes.String},
265265
},
266-
Out: tftypes.NewValue(tftypes.Map{AttributeType: tftypes.String}, map[string]tftypes.Value{
266+
Out: tftypes.NewValue(tftypes.Map{ElementType: tftypes.String}, map[string]tftypes.Value{
267267
"one": tftypes.NewValue(tftypes.String, "foo"),
268268
"two": tftypes.NewValue(tftypes.String, "bar"),
269269
"three": tftypes.NewValue(tftypes.String, "baz"),
@@ -280,9 +280,9 @@ func TestMorphValueToType(t *testing.T) {
280280
"two": tftypes.NewValue(tftypes.String, "bar"),
281281
"three": tftypes.NewValue(tftypes.String, "baz"),
282282
}),
283-
T: tftypes.Map{AttributeType: tftypes.String},
283+
T: tftypes.Map{ElementType: tftypes.String},
284284
},
285-
Out: tftypes.NewValue(tftypes.Map{AttributeType: tftypes.String}, map[string]tftypes.Value{
285+
Out: tftypes.NewValue(tftypes.Map{ElementType: tftypes.String}, map[string]tftypes.Value{
286286
"one": tftypes.NewValue(tftypes.String, "foo"),
287287
"two": tftypes.NewValue(tftypes.String, "bar"),
288288
"three": tftypes.NewValue(tftypes.String, "baz"),

manifest/morph/scaffold.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func DeepUnknown(t tftypes.Type, v tftypes.Value, p *tftypes.AttributePath) (tft
4747
}
4848
for name, el := range vals {
4949
np := p.WithElementKeyString(name)
50-
nv, err := DeepUnknown(t.(tftypes.Map).AttributeType, el, np)
50+
nv, err := DeepUnknown(t.(tftypes.Map).ElementType, el, np)
5151
if err != nil {
5252
return tftypes.Value{}, np.NewError(err)
5353
}
@@ -74,7 +74,7 @@ func DeepUnknown(t tftypes.Type, v tftypes.Value, p *tftypes.AttributePath) (tft
7474
return tftypes.Value{}, p.NewError(err)
7575
}
7676
for i, et := range atts {
77-
np := p.WithElementKeyInt(int64(i))
77+
np := p.WithElementKeyInt(i)
7878
nv, err := DeepUnknown(et, vals[i], np)
7979
if err != nil {
8080
return tftypes.Value{}, np.NewError(err)
@@ -99,7 +99,7 @@ func DeepUnknown(t tftypes.Type, v tftypes.Value, p *tftypes.AttributePath) (tft
9999
elt = t.(tftypes.Set).ElementType
100100
}
101101
for i, el := range vals {
102-
np := p.WithElementKeyInt(int64(i))
102+
np := p.WithElementKeyInt(i)
103103
nv, err := DeepUnknown(elt, el, np)
104104
if err != nil {
105105
return tftypes.Value{}, np.NewError(err)

manifest/openapi/foundry_v2_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ type testSamples map[string]testSample
2020

2121
var objectMetaType = tftypes.Object{
2222
AttributeTypes: map[string]tftypes.Type{
23-
"annotations": tftypes.Map{AttributeType: tftypes.String},
23+
"annotations": tftypes.Map{ElementType: tftypes.String},
2424
"clusterName": tftypes.String,
2525
"creationTimestamp": tftypes.String,
2626
"deletionGracePeriodSeconds": tftypes.Number,
2727
"deletionTimestamp": tftypes.String,
2828
"finalizers": tftypes.List{ElementType: tftypes.String},
2929
"generateName": tftypes.String,
3030
"generation": tftypes.Number,
31-
"labels": tftypes.Map{AttributeType: tftypes.String},
31+
"labels": tftypes.Map{ElementType: tftypes.String},
3232
"managedFields": tftypes.List{
3333
ElementType: tftypes.Object{
3434
AttributeTypes: map[string]tftypes.Type{
@@ -70,8 +70,8 @@ var samples = testSamples{
7070
"kind": tftypes.String,
7171
"metadata": objectMetaType,
7272
"immutable": tftypes.Bool,
73-
"data": tftypes.Map{AttributeType: tftypes.String},
74-
"binaryData": tftypes.Map{AttributeType: tftypes.String},
73+
"data": tftypes.Map{ElementType: tftypes.String},
74+
"binaryData": tftypes.Map{ElementType: tftypes.String},
7575
},
7676
},
7777
},
@@ -105,7 +105,7 @@ var samples = testSamples{
105105
},
106106
},
107107
"publishNotReadyAddresses": tftypes.Bool,
108-
"selector": tftypes.Map{AttributeType: tftypes.String},
108+
"selector": tftypes.Map{ElementType: tftypes.String},
109109
"sessionAffinity": tftypes.String,
110110
"sessionAffinityConfig": tftypes.Object{AttributeTypes: map[string]tftypes.Type{
111111
"clientIP": tftypes.Object{

manifest/openapi/schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func getTypeFromSchema(elem *openapi3.Schema, stackdepth uint64, typeCache *sync
160160
if err != nil {
161161
return nil, err
162162
}
163-
t = tftypes.Map{AttributeType: pt}
163+
t = tftypes.Map{ElementType: pt}
164164
if herr == nil {
165165
typeCache.Store(h, t)
166166
}

manifest/payload/from_value.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func FromTFValue(in tftypes.Value, ap *tftypes.AttributePath) (interface{}, erro
6060
return lv, nil
6161
}
6262
for k, le := range l {
63-
nextAp := ap.WithElementKeyInt(int64(k))
63+
nextAp := ap.WithElementKeyInt(k)
6464
ne, err := FromTFValue(le, nextAp)
6565
if err != nil {
6666
return nil, nextAp.NewErrorf("[%s] cannot convert list element to Unstructured: %s", nextAp.String(), err)

manifest/payload/from_value_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestFromTFValue(t *testing.T) {
3333
Out: []interface{}{"test1", "test2"},
3434
},
3535
"map-of-strings": {
36-
In: tftypes.NewValue(tftypes.Map{AttributeType: tftypes.String}, map[string]tftypes.Value{
36+
In: tftypes.NewValue(tftypes.Map{ElementType: tftypes.String}, map[string]tftypes.Value{
3737
"foo": tftypes.NewValue(tftypes.String, "test1"),
3838
"bar": tftypes.NewValue(tftypes.String, "test2"),
3939
}),

0 commit comments

Comments
 (0)