Skip to content

Commit 88d4ba1

Browse files
committed
tfprotov5+tfprotov6: Add GetProviderSchemaOptional server capability
Reference: #310
1 parent 5abb365 commit 88d4ba1

12 files changed

Lines changed: 672 additions & 602 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
kind: ENHANCEMENTS
2+
body: 'tfprotov5: Added `ServerCapabilities` type `GetProviderSchemaOptional` field,
3+
which when enabled can signal that the provider supports RPC operations without
4+
the `GetProviderSchema` RPC being called first'
5+
time: 2023-07-07T10:02:31.242394-04:00
6+
custom:
7+
Issue: "310"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
kind: ENHANCEMENTS
2+
body: 'tfprotov6: Added `ServerCapabilities` type `GetProviderSchemaOptional` field,
3+
which when enabled can signal that the provider supports RPC operations without
4+
the `GetProviderSchema` RPC being called first'
5+
time: 2023-07-07T10:03:39.802189-04:00
6+
custom:
7+
Issue: "310"

tfprotov5/internal/tfplugin5/tfplugin5.pb.go

Lines changed: 345 additions & 329 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tfprotov5/internal/tfplugin5/tfplugin5.proto

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Copyright (c) HashiCorp, Inc.
22
// SPDX-License-Identifier: MPL-2.0
33

4-
// Terraform Plugin RPC protocol version 5.3
4+
// Terraform Plugin RPC protocol version 5.4
55
//
6-
// This file defines version 5.3 of the RPC protocol. To implement a plugin
6+
// This file defines version 5.4 of the RPC protocol. To implement a plugin
77
// against this protocol, copy this definition into your own codebase and
88
// use protoc to generate stubs for your target language.
99
//
@@ -172,6 +172,12 @@ message GetProviderSchema {
172172
// The plan_destroy capability signals that a provider expects a call
173173
// to PlanResourceChange when a resource is going to be destroyed.
174174
bool plan_destroy = 1;
175+
176+
// The get_provider_schema_optional capability indicates that this
177+
// provider does not require calling GetProviderSchema to operate
178+
// normally, and the caller can used a cached copy of the provider's
179+
// schema.
180+
bool get_provider_schema_optional = 2;
175181
}
176182
}
177183

tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tfprotov5/internal/toproto/server_capabilities.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ func GetProviderSchema_ServerCapabilities(in *tfprotov5.ServerCapabilities) *tfp
1414
}
1515

1616
return &tfplugin5.GetProviderSchema_ServerCapabilities{
17-
PlanDestroy: in.PlanDestroy,
17+
GetProviderSchemaOptional: in.GetProviderSchemaOptional,
18+
PlanDestroy: in.PlanDestroy,
1819
}
1920
}

tfprotov5/server_capabilities.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@ type ServerCapabilities struct {
1414
// opt-in to prevent unexpected errors or panics since the
1515
// ProposedNewState in PlanResourceChangeRequest will be a null value.
1616
PlanDestroy bool
17+
18+
// GetProviderSchemaOptional signals that this provider does not require
19+
// having the GetProviderSchema RPC called first to operate normally. This
20+
// means the caller can use a cached copy of the provider's schema instead.
21+
GetProviderSchemaOptional bool
1722
}

tfprotov6/internal/tfplugin6/tfplugin6.pb.go

Lines changed: 277 additions & 261 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tfprotov6/internal/tfplugin6/tfplugin6.proto

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Copyright (c) HashiCorp, Inc.
22
// SPDX-License-Identifier: MPL-2.0
33

4-
// Terraform Plugin RPC protocol version 6.3
4+
// Terraform Plugin RPC protocol version 6.4
55
//
6-
// This file defines version 6.3 of the RPC protocol. To implement a plugin
6+
// This file defines version 6.4 of the RPC protocol. To implement a plugin
77
// against this protocol, copy this definition into your own codebase and
88
// use protoc to generate stubs for your target language.
99
//
@@ -191,6 +191,12 @@ message GetProviderSchema {
191191
// The plan_destroy capability signals that a provider expects a call
192192
// to PlanResourceChange when a resource is going to be destroyed.
193193
bool plan_destroy = 1;
194+
195+
// The get_provider_schema_optional capability indicates that this
196+
// provider does not require calling GetProviderSchema to operate
197+
// normally, and the caller can used a cached copy of the provider's
198+
// schema.
199+
bool get_provider_schema_optional = 2;
194200
}
195201
}
196202

tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)