Skip to content

Commit f4f97bd

Browse files
committed
remove apply client capability
1 parent 09ca993 commit f4f97bd

12 files changed

+51
-153
lines changed

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ toolchain go1.22.7
66

77
require (
88
github.com/google/go-cmp v0.6.0
9-
github.com/hashicorp/terraform-plugin-go v0.25.1-0.20241125193751-9019c19499e0
9+
github.com/hashicorp/terraform-plugin-go v0.25.1-0.20241217173851-dcf8f64dbfaa
1010
github.com/hashicorp/terraform-plugin-log v0.9.0
1111
)
1212

@@ -25,10 +25,10 @@ require (
2525
github.com/oklog/run v1.0.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.28.0 // indirect
29-
golang.org/x/sys v0.24.0 // indirect
30-
golang.org/x/text v0.17.0 // indirect
31-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
32-
google.golang.org/grpc v1.67.1 // indirect
28+
golang.org/x/net v0.29.0 // indirect
29+
golang.org/x/sys v0.25.0 // indirect
30+
golang.org/x/text v0.18.0 // indirect
31+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
32+
google.golang.org/grpc v1.68.1 // indirect
3333
google.golang.org/protobuf v1.35.2 // indirect
3434
)

go.sum

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ github.com/hashicorp/go-plugin v1.6.2 h1:zdGAEd0V1lCaU0u+MxWQhtSDQmahpkwOun8U8Ei
1515
github.com/hashicorp/go-plugin v1.6.2/go.mod h1:CkgLQ5CZqNmdL9U9JzM532t8ZiYQ35+pj3b1FD37R0Q=
1616
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
1717
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
18-
github.com/hashicorp/terraform-plugin-go v0.25.1-0.20241125193751-9019c19499e0 h1:92SnqDgZi6TgHrJlbP5UicGWgoZO+QQUrZyzwW2Ztqs=
19-
github.com/hashicorp/terraform-plugin-go v0.25.1-0.20241125193751-9019c19499e0/go.mod h1:f8P2pHGkZrtdKLpCI2qIvrewUY+c4nTvtayqjJR9IcY=
18+
github.com/hashicorp/terraform-plugin-go v0.25.1-0.20241217173851-dcf8f64dbfaa h1:GOXZVYZrfDrWxZMHdSNqZKDwayH8WBBtyOLx25ekwv8=
19+
github.com/hashicorp/terraform-plugin-go v0.25.1-0.20241217173851-dcf8f64dbfaa/go.mod h1:OKJU8uauqiLVRWjlFB0KIgK++baq26qfvOU1IVycx9k=
2020
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
2121
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
2222
github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI=
@@ -48,22 +48,22 @@ github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IU
4848
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
4949
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
5050
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
51-
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
52-
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
51+
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
52+
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
5353
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
5454
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
5555
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5656
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5757
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5858
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
59-
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
60-
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
61-
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
62-
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
63-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs=
64-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
65-
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
66-
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
59+
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
60+
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
61+
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
62+
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
63+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ=
64+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
65+
google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0=
66+
google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw=
6767
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
6868
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
6969
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

internal/fromproto5/applyresourcechange.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ func ApplyResourceChangeRequest(ctx context.Context, proto5 *tfprotov5.ApplyReso
4343
Resource: resource,
4444
}
4545

46-
fw.ClientCapabilities = ApplyResourceChangeClientCapabilities(proto5.ClientCapabilities)
47-
4846
config, configDiags := Config(ctx, proto5.Config, resourceSchema)
4947

5048
diags.Append(configDiags...)

internal/fromproto5/applyresourcechange_test.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -81,30 +81,6 @@ func TestApplyResourceChangeRequest(t *testing.T) {
8181
),
8282
},
8383
},
84-
"client-capabilities": {
85-
input: &tfprotov5.ApplyResourceChangeRequest{
86-
ClientCapabilities: &tfprotov5.ApplyResourceChangeClientCapabilities{
87-
WriteOnlyAttributesAllowed: true,
88-
},
89-
},
90-
resourceSchema: testFwSchema,
91-
expected: &fwserver.ApplyResourceChangeRequest{
92-
ClientCapabilities: fwserver.ApplyResourceChangeClientCapabilities{
93-
WriteOnlyAttributesAllowed: true,
94-
},
95-
ResourceSchema: testFwSchema,
96-
},
97-
},
98-
"client-capabilities-unset": {
99-
input: &tfprotov5.ApplyResourceChangeRequest{},
100-
resourceSchema: testFwSchema,
101-
expected: &fwserver.ApplyResourceChangeRequest{
102-
ClientCapabilities: fwserver.ApplyResourceChangeClientCapabilities{
103-
WriteOnlyAttributesAllowed: false,
104-
},
105-
ResourceSchema: testFwSchema,
106-
},
107-
},
10884
"config-missing-schema": {
10985
input: &tfprotov5.ApplyResourceChangeRequest{
11086
Config: &testProto5DynamicValue,

internal/fromproto5/client_capabilities.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,10 @@ import (
88

99
"github.com/hashicorp/terraform-plugin-framework/datasource"
1010
"github.com/hashicorp/terraform-plugin-framework/ephemeral"
11-
"github.com/hashicorp/terraform-plugin-framework/internal/fwserver"
1211
"github.com/hashicorp/terraform-plugin-framework/provider"
1312
"github.com/hashicorp/terraform-plugin-framework/resource"
1413
)
1514

16-
func ApplyResourceChangeClientCapabilities(in *tfprotov5.ApplyResourceChangeClientCapabilities) fwserver.ApplyResourceChangeClientCapabilities {
17-
if in == nil {
18-
// Client did not indicate any supported capabilities
19-
return fwserver.ApplyResourceChangeClientCapabilities{
20-
WriteOnlyAttributesAllowed: false,
21-
}
22-
}
23-
24-
return fwserver.ApplyResourceChangeClientCapabilities{
25-
WriteOnlyAttributesAllowed: in.WriteOnlyAttributesAllowed,
26-
}
27-
}
28-
2915
func ConfigureProviderClientCapabilities(in *tfprotov5.ConfigureProviderClientCapabilities) provider.ConfigureProviderClientCapabilities {
3016
if in == nil {
3117
// Client did not indicate any supported capabilities

internal/fromproto6/applyresourcechange.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ func ApplyResourceChangeRequest(ctx context.Context, proto6 *tfprotov6.ApplyReso
4343
Resource: resource,
4444
}
4545

46-
fw.ClientCapabilities = ApplyResourceChangeClientCapabilities(proto6.ClientCapabilities)
47-
4846
config, configDiags := Config(ctx, proto6.Config, resourceSchema)
4947

5048
diags.Append(configDiags...)

internal/fromproto6/applyresourcechange_test.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -81,30 +81,6 @@ func TestApplyResourceChangeRequest(t *testing.T) {
8181
),
8282
},
8383
},
84-
"client-capabilities": {
85-
input: &tfprotov6.ApplyResourceChangeRequest{
86-
ClientCapabilities: &tfprotov6.ApplyResourceChangeClientCapabilities{
87-
WriteOnlyAttributesAllowed: true,
88-
},
89-
},
90-
resourceSchema: testFwSchema,
91-
expected: &fwserver.ApplyResourceChangeRequest{
92-
ClientCapabilities: fwserver.ApplyResourceChangeClientCapabilities{
93-
WriteOnlyAttributesAllowed: true,
94-
},
95-
ResourceSchema: testFwSchema,
96-
},
97-
},
98-
"client-capabilities-unset": {
99-
input: &tfprotov6.ApplyResourceChangeRequest{},
100-
resourceSchema: testFwSchema,
101-
expected: &fwserver.ApplyResourceChangeRequest{
102-
ClientCapabilities: fwserver.ApplyResourceChangeClientCapabilities{
103-
WriteOnlyAttributesAllowed: false,
104-
},
105-
ResourceSchema: testFwSchema,
106-
},
107-
},
10884
"config-missing-schema": {
10985
input: &tfprotov6.ApplyResourceChangeRequest{
11086
Config: &testProto6DynamicValue,

internal/fromproto6/client_capabilities.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,10 @@ import (
88

99
"github.com/hashicorp/terraform-plugin-framework/datasource"
1010
"github.com/hashicorp/terraform-plugin-framework/ephemeral"
11-
"github.com/hashicorp/terraform-plugin-framework/internal/fwserver"
1211
"github.com/hashicorp/terraform-plugin-framework/provider"
1312
"github.com/hashicorp/terraform-plugin-framework/resource"
1413
)
1514

16-
func ApplyResourceChangeClientCapabilities(in *tfprotov6.ApplyResourceChangeClientCapabilities) fwserver.ApplyResourceChangeClientCapabilities {
17-
if in == nil {
18-
// Client did not indicate any supported capabilities
19-
return fwserver.ApplyResourceChangeClientCapabilities{
20-
WriteOnlyAttributesAllowed: false,
21-
}
22-
}
23-
24-
return fwserver.ApplyResourceChangeClientCapabilities{
25-
WriteOnlyAttributesAllowed: in.WriteOnlyAttributesAllowed,
26-
}
27-
}
28-
2915
func ConfigureProviderClientCapabilities(in *tfprotov6.ConfigureProviderClientCapabilities) provider.ConfigureProviderClientCapabilities {
3016
if in == nil {
3117
// Client did not indicate any supported capabilities

internal/fwserver/server_applyresourcechange.go

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,16 @@ import (
1414
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
1515
)
1616

17-
// ApplyResourceChangeClientCapabilities allows Terraform to publish information
18-
// regarding optionally supported protocol features for the
19-
// ApplyResourceChange RPC, such as forward-compatible Terraform behavior
20-
// changes.
21-
type ApplyResourceChangeClientCapabilities struct {
22-
// WriteOnlyAttributesAllowed indicates that the Terraform client
23-
// initiating the request supports write-only attributes for managed
24-
// resources.
25-
WriteOnlyAttributesAllowed bool
26-
}
27-
2817
// ApplyResourceChangeRequest is the framework server request for the
2918
// ApplyResourceChange RPC.
3019
type ApplyResourceChangeRequest struct {
31-
ClientCapabilities ApplyResourceChangeClientCapabilities
32-
Config *tfsdk.Config
33-
PlannedPrivate *privatestate.Data
34-
PlannedState *tfsdk.Plan
35-
PriorState *tfsdk.State
36-
ProviderMeta *tfsdk.Config
37-
ResourceSchema fwschema.Schema
38-
Resource resource.Resource
20+
Config *tfsdk.Config
21+
PlannedPrivate *privatestate.Data
22+
PlannedState *tfsdk.Plan
23+
PriorState *tfsdk.State
24+
ProviderMeta *tfsdk.Config
25+
ResourceSchema fwschema.Schema
26+
Resource resource.Resource
3927
}
4028

4129
// ApplyResourceChangeResponse is the framework server response for the
@@ -57,13 +45,12 @@ func (s *Server) ApplyResourceChange(ctx context.Context, req *ApplyResourceChan
5745
logging.FrameworkTrace(ctx, "ApplyResourceChange received no PriorState, running CreateResource")
5846

5947
createReq := &CreateResourceRequest{
60-
ClientCapabilities: req.ClientCapabilities,
61-
Config: req.Config,
62-
PlannedPrivate: req.PlannedPrivate,
63-
PlannedState: req.PlannedState,
64-
ProviderMeta: req.ProviderMeta,
65-
ResourceSchema: req.ResourceSchema,
66-
Resource: req.Resource,
48+
Config: req.Config,
49+
PlannedPrivate: req.PlannedPrivate,
50+
PlannedState: req.PlannedState,
51+
ProviderMeta: req.ProviderMeta,
52+
ResourceSchema: req.ResourceSchema,
53+
Resource: req.Resource,
6754
}
6855
createResp := &CreateResourceResponse{}
6956

@@ -102,14 +89,13 @@ func (s *Server) ApplyResourceChange(ctx context.Context, req *ApplyResourceChan
10289
logging.FrameworkTrace(ctx, "ApplyResourceChange running UpdateResource")
10390

10491
updateReq := &UpdateResourceRequest{
105-
ClientCapabilities: req.ClientCapabilities,
106-
Config: req.Config,
107-
PlannedPrivate: req.PlannedPrivate,
108-
PlannedState: req.PlannedState,
109-
PriorState: req.PriorState,
110-
ProviderMeta: req.ProviderMeta,
111-
ResourceSchema: req.ResourceSchema,
112-
Resource: req.Resource,
92+
Config: req.Config,
93+
PlannedPrivate: req.PlannedPrivate,
94+
PlannedState: req.PlannedState,
95+
PriorState: req.PriorState,
96+
ProviderMeta: req.ProviderMeta,
97+
ResourceSchema: req.ResourceSchema,
98+
Resource: req.Resource,
11399
}
114100
updateResp := &UpdateResourceResponse{}
115101

internal/fwserver/server_applyresourcechange_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,6 @@ func TestServerApplyResourceChange(t *testing.T) {
428428
Provider: &testprovider.Provider{},
429429
},
430430
request: &fwserver.ApplyResourceChangeRequest{
431-
ClientCapabilities: fwserver.ApplyResourceChangeClientCapabilities{
432-
WriteOnlyAttributesAllowed: true,
433-
},
434431
Config: &tfsdk.Config{
435432
Raw: tftypes.NewValue(testSchemaTypeWriteOnly, map[string]tftypes.Value{
436433
"test_optional_write_only": tftypes.NewValue(tftypes.String, "test-config-value"),
@@ -1339,9 +1336,6 @@ func TestServerApplyResourceChange(t *testing.T) {
13391336
Provider: &testprovider.Provider{},
13401337
},
13411338
request: &fwserver.ApplyResourceChangeRequest{
1342-
ClientCapabilities: fwserver.ApplyResourceChangeClientCapabilities{
1343-
WriteOnlyAttributesAllowed: true,
1344-
},
13451339
Config: &tfsdk.Config{
13461340
Raw: tftypes.NewValue(testSchemaTypeWriteOnly, map[string]tftypes.Value{
13471341
"test_optional_write_only": tftypes.NewValue(tftypes.String, "test-config-value"),

0 commit comments

Comments
 (0)