Skip to content

Commit b6a09b0

Browse files
committed
Updated read to be similar to invoke actions and handle streaming in protov6server
1 parent af13637 commit b6a09b0

38 files changed

+1201
-589
lines changed

go.mod

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
module github.com/hashicorp/terraform-plugin-framework
22

3-
go 1.24.0
3+
go 1.24.6
44

5-
toolchain go1.24.4
5+
toolchain go1.24.10
66

77
require (
88
github.com/google/go-cmp v0.7.0
9-
github.com/hashicorp/terraform-plugin-go v0.29.1-0.20251107103451-b1dbec9688da
9+
github.com/hashicorp/terraform-plugin-go v0.29.1-0.20251120001236-e53907d2fbfe
1010
github.com/hashicorp/terraform-plugin-log v0.9.0
1111
)
1212

1313
require (
14-
github.com/fatih/color v1.15.0 // indirect
14+
github.com/fatih/color v1.18.0 // indirect
1515
github.com/golang/protobuf v1.5.4 // indirect
1616
github.com/hashicorp/go-hclog v1.6.3 // indirect
1717
github.com/hashicorp/go-plugin v1.7.0 // indirect
1818
github.com/hashicorp/go-uuid v1.0.3 // indirect
1919
github.com/hashicorp/terraform-registry-address v0.4.0 // indirect
2020
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
2121
github.com/hashicorp/yamux v0.1.2 // indirect
22-
github.com/mattn/go-colorable v0.1.13 // indirect
23-
github.com/mattn/go-isatty v0.0.19 // indirect
22+
github.com/mattn/go-colorable v0.1.14 // indirect
23+
github.com/mattn/go-isatty v0.0.20 // indirect
2424
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
2525
github.com/oklog/run v1.1.0 // indirect
2626
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
2727
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
28-
golang.org/x/net v0.43.0 // indirect
29-
golang.org/x/sys v0.35.0 // indirect
30-
golang.org/x/text v0.28.0 // indirect
28+
golang.org/x/net v0.46.0 // indirect
29+
golang.org/x/sys v0.37.0 // indirect
30+
golang.org/x/text v0.30.0 // indirect
3131
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b // indirect
3232
google.golang.org/grpc v1.76.0 // indirect
3333
google.golang.org/protobuf v1.36.10 // indirect

go.sum

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
55
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
66
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
77
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
8-
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
9-
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
8+
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
9+
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
1010
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
1111
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
1212
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
@@ -23,8 +23,8 @@ github.com/hashicorp/go-plugin v1.7.0 h1:YghfQH/0QmPNc/AZMTFE3ac8fipZyZECHdDPshf
2323
github.com/hashicorp/go-plugin v1.7.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8=
2424
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
2525
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
26-
github.com/hashicorp/terraform-plugin-go v0.29.1-0.20251107103451-b1dbec9688da h1:RvFdseryCMkoBWxucUSEnQkeROpBiungf3bNQV1efgc=
27-
github.com/hashicorp/terraform-plugin-go v0.29.1-0.20251107103451-b1dbec9688da/go.mod h1:KHRnT9vExG+r1fLxwOzOP6C6YXiaKHtsCIrky7teDYc=
26+
github.com/hashicorp/terraform-plugin-go v0.29.1-0.20251120001236-e53907d2fbfe h1:RPnYwDCbHCSFRce4qL7Ri6m8zMRpJUcfanjXlPP2An4=
27+
github.com/hashicorp/terraform-plugin-go v0.29.1-0.20251120001236-e53907d2fbfe/go.mod h1:FzPYKPuLPF5fPvJjWUXPhbkXeL1x5aATwzQeqOKYOYU=
2828
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
2929
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
3030
github.com/hashicorp/terraform-registry-address v0.4.0 h1:S1yCGomj30Sao4l5BMPjTGZmCNzuv7/GDTDX99E9gTk=
@@ -37,13 +37,12 @@ github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5Xum
3737
github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8=
3838
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
3939
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
40-
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
41-
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
40+
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
41+
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
4242
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
4343
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
44-
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
45-
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
46-
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
44+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
45+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
4746
github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
4847
github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
4948
github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
@@ -71,19 +70,18 @@ go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFh
7170
go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps=
7271
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
7372
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
74-
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
75-
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
73+
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
74+
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
7675
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
7776
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
7877
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
7978
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
8079
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
81-
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
8280
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
83-
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
84-
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
85-
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
86-
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
81+
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
82+
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
83+
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
84+
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
8785
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
8886
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
8987
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b h1:zPKJod4w6F1+nRGDI9ubnXYhU9NSWoFAijkHkUXeTK8=

internal/fromproto6/client_capabilities.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package fromproto6
55

66
import (
7+
"github.com/hashicorp/terraform-plugin-framework/statestore"
78
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
89

910
"github.com/hashicorp/terraform-plugin-framework/action"
@@ -26,20 +27,6 @@ func ConfigureProviderClientCapabilities(in *tfprotov6.ConfigureProviderClientCa
2627
}
2728
}
2829

29-
// TODO: Add to plugin-go tfprotov6 and implement properly when capabilities are defined.
30-
func ConfigureStateStoreClientCapabilities(in *tfprotov6.ConfigureStateStoreClientCapabilities) provider.ConfigureStateStoreClientCapabilities {
31-
if in == nil {
32-
// Client did not indicate any supported capabilities
33-
return provider.ConfigureStateStoreClientCapabilities{
34-
DeferralAllowed: false,
35-
}
36-
}
37-
38-
return provider.ConfigureStateStoreClientCapabilities{
39-
DeferralAllowed: in.DeferralAllowed,
40-
}
41-
}
42-
4330
func ReadDataSourceClientCapabilities(in *tfprotov6.ReadDataSourceClientCapabilities) datasource.ReadClientCapabilities {
4431
if in == nil {
4532
// Client did not indicate any supported capabilities
@@ -130,3 +117,16 @@ func ModifyPlanActionClientCapabilities(in *tfprotov6.PlanActionClientCapabiliti
130117
DeferralAllowed: in.DeferralAllowed,
131118
}
132119
}
120+
121+
func ConfigureStateStoreClientCapabilities(in *tfprotov6.ConfigureStateStoreClientCapabilities) statestore.StateStoreClientCapabilities {
122+
if in == nil {
123+
// Client did not indicate any supported capabilities
124+
return statestore.StateStoreClientCapabilities{
125+
DeferralAllowed: false,
126+
}
127+
}
128+
129+
return statestore.StateStoreClientCapabilities{
130+
DeferralAllowed: in.DeferralAllowed,
131+
}
132+
}

internal/fromproto6/configurestatestore.go

Lines changed: 0 additions & 35 deletions
This file was deleted.

internal/fromproto6/configurestatestore_test.go

Lines changed: 0 additions & 135 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
4+
package fromproto6
5+
6+
import (
7+
"context"
8+
9+
"github.com/hashicorp/terraform-plugin-framework/internal/fwserver"
10+
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
11+
)
12+
13+
// DeleteStateRequest returns the *fwserver.DeleteStateRequest
14+
// equivalent of a *tfprotov6.DeleteStateRequest.
15+
func DeleteStateRequest(ctx context.Context, proto6 *tfprotov6.DeleteStateRequest) *fwserver.DeleteStatesRequest {
16+
if proto6 == nil {
17+
return nil
18+
}
19+
20+
fw := &fwserver.DeleteStatesRequest{}
21+
22+
return fw
23+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
4+
package fromproto6_test
5+
6+
import (
7+
"context"
8+
"testing"
9+
10+
"github.com/google/go-cmp/cmp"
11+
"github.com/hashicorp/terraform-plugin-framework/internal/fromproto6"
12+
"github.com/hashicorp/terraform-plugin-framework/internal/fwserver"
13+
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
14+
)
15+
16+
func TestDeleteStateRequest(t *testing.T) {
17+
t.Parallel()
18+
19+
testCases := map[string]struct {
20+
input *tfprotov6.DeleteStateRequest
21+
expected *fwserver.DeleteStatesRequest
22+
}{
23+
"nil": {
24+
input: nil,
25+
expected: nil,
26+
},
27+
"empty": {
28+
input: &tfprotov6.DeleteStateRequest{},
29+
expected: &fwserver.DeleteStatesRequest{},
30+
},
31+
}
32+
33+
for name, testCase := range testCases {
34+
t.Run(name, func(t *testing.T) {
35+
t.Parallel()
36+
37+
got := fromproto6.DeleteStateRequest(context.Background(), testCase.input)
38+
39+
if diff := cmp.Diff(got, testCase.expected); diff != "" {
40+
t.Errorf("unexpected difference: %s", diff)
41+
}
42+
})
43+
}
44+
}

0 commit comments

Comments
 (0)