Proto commits in hashicorp/terraform-plugin-go

These 97 commits are when the Protocol Buffers files have changed:

Commit:7f3cf19
Author:Austin Valle

(╯°□°)╯︵ ┻━┻

Commit:bcf8bf1
Author:Rain

Added more channges to the schema for computed blocks

Commit:5db5abd
Author:Rain

Added schema changes

Commit:d6a9818
Author:Rain

fixed conflict

Commit:ffc7861
Author:Rain

Added support for computed blocks in the client capabilities and logging.

Commit:773b5fb
Author:Austin Valle

proto impl

Commit:e48445a
Author:stephybun
Committer:GitHub

Add `GenerateResourceConfig` RPC to Protocol v5 (#578) * add generate resource config rpc * make protobuf * add rpc to provider server * add toproto and fromproto tests, code comments and thread through generate resource config server capabilities flag * remove GenerateResourceConfig method from ProviderServer interface * add GenerateResourceConfig RPC to tf5server * temporary interface the new RPC * add copyright headers * remove experimental remnants and add todo comment * remove dedicated logging context and temporary interface * uncomment logging context that was causing issues while prototyping earlier... * Add copyright headers --------- Co-authored-by: Selena Goods <github@simplebox.anonaddy.com>

Commit:e392eb6
Author:Ansgar Mertens
Committer:GitHub

add deprecation_message to grpc proto and schema structs (#600) * add deprecation_message to grpc proto and schema structs * add tests for toproto * add changie entry

Commit:caa1250
Author:dependabot[bot]
Committer:GitHub

build(deps): Bump github.com/hashicorp/copywrite from 0.24.0 to 0.24.2 in /tools (#599) * build(deps): Bump github.com/hashicorp/copywrite in /tools Bumps [github.com/hashicorp/copywrite](https://github.com/hashicorp/copywrite) from 0.24.0 to 0.24.2. - [Release notes](https://github.com/hashicorp/copywrite/releases) - [Commits](https://github.com/hashicorp/copywrite/compare/v0.24.0...v0.24.2) --- updated-dependencies: - dependency-name: github.com/hashicorp/copywrite dependency-version: 0.24.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * updated copywrite --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Rain <rainskwan@gmail.com>

Commit:b0a6aca
Author:Austin Valle
Committer:GitHub

tfprotov6: Add package docs for state store types, refactoring, add unit tests (#594) * update protocol version * logging key comment * doc comment * fix the rest of feedback, still need package docs * add package docs * add changelogs

Commit:dfb1155
Author:Radek Simko
Committer:GitHub

tfprotov6: Add protocol support for pluggable state storage (#563) * Add protocol support for pluggable state stores * Implement ValidateStateStoreConfig + ConfigureStateStore methods * implement ReadStateBytes * implement WriteStateBytes * Use iter.Seq2 to allow errors to be accessed by calling code in downstream provider implementation * Stop iterator using return instead of break * Formatting * Update `WriteStateBytesStream` to not use Seq2, instead iterate over 'messages' that contain both chunk data and any raised grpc errors * Seeing what it looks like to use 'message' as name * Seeing what it looks like to avoid 'messages' name * Update WriteStateBytesStreamMsg => WriteStateBytesChunk * implement state chunk size negotiation * handle metadata in WriteStateBytes correctly * Add LockState and UnlockState methods to .proto file for Protocol v6 * Run `make protobuf` * Add handwritten code related to LockState and UnlockState RPCs * Running `make protobuf` after rebasing onto main * Add missing (Lock/Unlock)State related code * add LockId mapping :P --------- Co-authored-by: Sarah French <sarah.french@hashicorp.com>

Commit:26bd361
Author:Austin Valle

update proto file

Commit:287794a
Author:hashicorp-copywrite[bot]
Committer:github-actions[bot]

[COMPLIANCE] Update Copyright and License Headers (Batch 1 of 1)

Commit:2af8589
Author:Sarah French
Committer:Sarah French

Add LockState and UnlockState methods to .proto file for Protocol v6

Commit:f0742c4
Author:Radek Simko
Committer:Sarah French

handle metadata in WriteStateBytes correctly

Commit:969b6aa
Author:Radek Simko
Committer:Sarah French

implement state chunk size negotiation

Commit:96ced35
Author:Radek Simko
Committer:Sarah French

Add protocol support for pluggable state stores

Commit:c448cd9
Author:Sarah French

Add LockState and UnlockState methods to .proto file for Protocol v6

Commit:3809bb8
Author:Austin Valle
Committer:Austin Valle

revert

The documentation is generated from this commit.

Commit:2ebf316
Author:Austin Valle
Committer:Austin Valle

example failure

Commit:5403454
Author:Austin Valle
Committer:Austin Valle

readjust proto

The documentation is generated from this commit.

Commit:b247d03
Author:Austin Valle
Committer:Austin Valle

example failure

Commit:f4bfdf2
Author:Austin Valle

revert

The documentation is generated from this commit.

Commit:7d54f62
Author:Austin Valle

example failure

Commit:586d576
Author:Austin Valle

readjust proto

The documentation is generated from this commit.

Commit:8bb581b
Author:Austin Valle

example failure

Commit:fca79ea
Author:Radek Simko
Committer:Radek Simko

handle metadata in WriteStateBytes correctly

Commit:7c1acc3
Author:Radek Simko
Committer:Radek Simko

implement state chunk size negotiation

Commit:64ed4c9
Author:Radek Simko
Committer:Radek Simko

Add protocol support for pluggable state stores

Commit:04d7176
Author:Radek Simko
Committer:Radek Simko

implement state chunk size negotiation

Commit:a498eaf
Author:Radek Simko
Committer:Radek Simko

Add protocol support for pluggable state stores

Commit:c3810b1
Author:Selena Goods
Committer:GitHub

Simplify actions to one schema type (#559) * Update protocol v5 to remove other action types * Update protocol v6 to remove other action types * update protoc version * downgrade protoc version * Remove additional references to linked actions

The documentation is generated from this commit.

Commit:b1799eb
Author:Selena Goods

Update protocol v6 to remove other action types

The documentation is generated from this commit.

Commit:f39355c
Author:Selena Goods
Committer:Selena Goods

Update protocol v5 to remove other action types

Commit:4c19f06
Author:Austin Valle
Committer:GitHub

Update action proto v5/v6 definitions to match TF core (#554) * remove schema types + adjust protocol * add linked resource config to validate * adjust go version back

Commit:4b545b8
Author:Austin Valle

remove schema types + adjust protocol

Commit:e33a533
Author:Austin Valle
Committer:GitHub

tfprotov5+tfprotov6: Add action validation RPC + fix proto field numbering (#539) * proto changes * add validate rpc

Commit:83c0f9a
Author:Austin Valle

proto changes

Commit:cf99b16
Author:stephybun
Committer:GitHub

pull in proto changes to validate IncludeResourceObject as well as Limit in list config (#538)

Commit:989fc21
Author:Steph

pull in proto changes to validate IncludeResourceObject as well as Limit in list config

Commit:a8477a1
Author:Austin Valle
Committer:GitHub

tfprotov5+tfprotov6: Add protocol support for planning/invoking actions (#534) * exported types first for protov5 * update proto to be config * fromproto and toproto * add to protov5 server * from proto tests * toproto tests * logging test * package docs * protov6 * mention provider prefix

Commit:a0c2704
Author:Austin Valle
Committer:Austin Valle

update proto to be config

Commit:06cc08e
Author:stephybun
Committer:GitHub

Update `ListResource` to include `limit` (#532) * update ListResource to include limit * add limit to list definition and request

Commit:31c2f3d
Author:Steph

update ListResource to include limit

Commit:d20658e
Author:Austin Valle

update proto to be config

Commit:55e8e16
Author:Ansgar Mertens
Committer:GitHub

TFECO-9502: chore: update protobuf definitions to include actions rpcs and messages (#513) * chore: update protobuf definitions to include actions rpcs and messages * fix: LinkedAttribute type should be singular * Apply suggestions from code review Co-authored-by: Selena Goods <github@simplebox.anonaddy.com> * update actions protocol to latest revision * quick re-sync with protocol proposal --------- Co-authored-by: Selena Goods <github@simplebox.anonaddy.com> Co-authored-by: Austin Valle <austinvalle@gmail.com>

Commit:e073170
Author:Ansgar Mertens
Committer:Ansgar Mertens

Apply suggestions from code review Co-authored-by: Selena Goods <github@simplebox.anonaddy.com>

Commit:5eff9bc
Author:Ansgar Mertens
Committer:Ansgar Mertens

update actions protocol to latest revision

Commit:d1b4b99
Author:Ansgar Mertens
Committer:Ansgar Mertens

fix: LinkedAttribute type should be singular

Commit:62e20fa
Author:Ansgar Mertens
Committer:Ansgar Mertens

chore: update protobuf definitions to include actions rpcs and messages

Commit:644e4c6
Author:Ansgar Mertens
Committer:Ansgar Mertens

Apply suggestions from code review Co-authored-by: Selena Goods <github@simplebox.anonaddy.com>

Commit:bc84008
Author:Ansgar Mertens
Committer:Ansgar Mertens

fix: LinkedAttribute type should be singular

Commit:e635a6a
Author:Ansgar Mertens
Committer:Ansgar Mertens

chore: update protobuf definitions to include actions rpcs and messages

Commit:4ac3dc4
Author:Rain
Committer:Ansgar Mertens

Add back protobuf for list

Commit:c12c314
Author:Rain
Committer:Ansgar Mertens

Add back protobuf for list

Commit:1ee6648
Author:Ansgar Mertens
Committer:GitHub

Apply suggestions from code review Co-authored-by: Selena Goods <github@simplebox.anonaddy.com>

Commit:87c004d
Author:Ansgar Mertens
Committer:Ansgar Mertens

chore: update protobuf definitions to include actions rpcs and messages

Commit:e8c485f
Author:Ansgar Mertens
Committer:Ansgar Mertens

fix: LinkedAttribute type should be singular

Commit:3d696d9
Author:Rain
Committer:Ansgar Mertens

Add back protobuf for list

Commit:5bbe022
Author:Rain
Committer:Ansgar Mertens

Add back protobuf for list

Commit:553984c
Author:Rain Kwan
Committer:GitHub

Add back protobuf support for list messages and rpcs (#522) * Add protobuf support for list messages and rpcs (#512) * Add protobuf support for list messages and rpcs (cherry picked from commit f412d3942e55695a3afac20f7f2862ba4bfb4d00) * Add back protobuf for list

Commit:1ebdfa6
Author:Ansgar Mertens

fix: LinkedAttribute type should be singular

Commit:168b7fd
Author:Ansgar Mertens
Committer:Ansgar Mertens

chore: update protobuf definitions to include actions rpcs and messages

Commit:dd82eea
Author:Rain

Add back protobuf for list

Commit:714b3dd
Author:Rain

Add back protobuf for list

Commit:9ed6abf
Author:Rain Kwan
Committer:Rain

Add protobuf support for list messages and rpcs (#512) * Add protobuf support for list messages and rpcs * Update protobuf to reflect core changes (cherry picked from commit f412d3942e55695a3afac20f7f2862ba4bfb4d00)

Commit:0c51a41
Author:Austin Valle
Committer:GitHub

Revert "Add protobuf support for list messages and rpcs (#512)" (#515) This reverts commit f412d3942e55695a3afac20f7f2862ba4bfb4d00.

Commit:5e45df2
Author:Ansgar Mertens
Committer:Ansgar Mertens

chore: update protobuf definitions to include actions rpcs and messages

Commit:f412d39
Author:Rain Kwan
Committer:GitHub

Add protobuf support for list messages and rpcs (#512) * Add protobuf support for list messages and rpcs * Update protobuf to reflect core changes

Commit:00cc5aa
Author:Rain
Committer:Rain Kwan

Update protobuf to reflect core changes

Commit:fd644f5
Author:Rain
Committer:Rain Kwan

Add protobuf support for list messages and rpcs

Commit:afdfc51
Author:Rain

Add protobuf support for list messages and rpcs

Commit:9f5f3e6
Author:Selena Goods

Update with latest protocol changes

Commit:d936f71
Author:Selena Goods

Update with latest protocol changes

Commit:8747337
Author:Selena Goods

Initial Actions prototype implementation

Commit:b799d5c
Author:Rain Kwan
Committer:GitHub

Updated protocol to reflect core changes to protocol move request (#487) * Updated protocol to reflect core changes to raw identity * RawIdentity Co-authored-by: Austin Valle <austinvalle@gmail.com> * RawIdentity Co-authored-by: Austin Valle <austinvalle@gmail.com> * Update tfprotov6/resource.go Co-authored-by: Austin Valle <austinvalle@gmail.com> * Update tfprotov5/resource.go Co-authored-by: Austin Valle <austinvalle@gmail.com> * Fixed bug from suggestions * Fixed bug from suggestions --------- Co-authored-by: Austin Valle <austinvalle@gmail.com>

Commit:6ebe79b
Author:Rain Kwan
Committer:GitHub

tfprotov5: Resource Identity implementation (#474) * start writing files for v5 * add missing code comments * add new fields added by identity protocol changes made by core * add missing copywrite headers * remove traces of flatmap from copied file that were missed * put new rpc calls in separate interface * first bunch of tests for files that already existed (and some for new files that are helpers for the other tests in prior art only) * Added test files for toproto for tfprotov5 and started adding to logging. Also addressed renamed the file as per suggested in the previous PR. * Fixing typo * update attribute names to match latest protobuf schema * fix tests * add test for raw_identity (copied from state.go) * update to latest gprc schema used by core * remove ResourceIdentityContext as we don't need it * add attributes for new identity data added to the protocol recently * add comments and fix logging * Apply suggestions from code review --------- Co-authored-by: Ansgar Mertens <ansgar@hashicorp.com> Co-authored-by: Austin Valle <austinvalle@gmail.com>

Commit:71a1984
Author:Ansgar Mertens
Committer:GitHub

Add protobuf support for resource identity messages and rpcs (#472) * Add protobuf support for resource identity messages and rpcs * add more identity procotol changes made by core * implement core change to rename prior_identity to planned_identity for ApplyResourceChange.Request

Commit:a1ee39e
Author:Ansgar Mertens

add more identity procotol changes made by core

Commit:f1f8392
Author:Ansgar Mertens
Committer:Ansgar Mertens

Add protobuf support for resource identity messages and rpcs

Commit:afd18f1
Author:Selena Goods
Committer:GitHub

tfprotov5+tfprotov6: Write-only Attribute Implementation (#462) * Upgrade Go to `v1.22` * Add support for ephemeral resources in protocol version 6 * Add support for ephemeral resources in protocol version 5 * Add ephemeral resources field to `GetMetadata_Response()` * Update tfplugin5.proto and tfplugin5.proto to support write-only attributes and generate stubs. * Implement write-only attributes in `tfprotov5` and `tfprotov6` packages * Remove `State` field from `RenewEphemeralResource` RPC response and rename `PriorState` request fields to `State`. * Update tfplugin5.proto and tfplugin5.proto to support write-only attributes and generate stubs. * Implement write-only attributes in `tfprotov5` and `tfprotov6` packages * Update protobuf stubs after rebase * Increase protocol minor version for write-only attributes * switch interfaces to be optional * removed `config` from renew request * Update protocol bindings * remove ApplyResourceChange client capabilities + add server logging for validate resource config * Update `protoc` to `v29.3` in CI * Add changelog entry * Apply suggestions from code review Co-authored-by: Austin Valle <austinvalle@gmail.com> --------- Co-authored-by: Austin Valle <austinvalle@gmail.com>

Commit:879185f
Author:Selena Goods
Committer:GitHub

tfprotov5+tfprotov6: Initial ephemeral resource type implementation (#441) * Upgrade Go to `v1.22` * Add support for ephemeral resources in protocol version 6 * Add support for ephemeral resources in protocol version 5 * Add ephemeral resources field to `GetMetadata_Response()` * Remove `State` field from `RenewEphemeralResource` RPC response and rename `PriorState` request fields to `State`. * switch interfaces to be optional * removed `config` from renew request * update protocol to match core + added logging * Update protocol bindings * Add changelog entries * Fix comment wording based off of PR feedback --------- Co-authored-by: Austin Valle <austinvalle@gmail.com>

Commit:8e4acd3
Author:Austin Valle
Committer:GitHub

tfprotov5+tfprotov6: Add deferred action support to related RPCs (#403) * generate protocol bindings * add protocol bindings to external interface * build(deps): Bump google.golang.org/grpc from 1.63.0 to 1.63.2 (#394) Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.63.0 to 1.63.2. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.63.0...v1.63.2) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * workflows: Remove wildcard suffix from Terraform workflow call (#395) * don't marshal integer values as msgpack floats (#396) * don't marshal integer values as msgpack floats Round-tripping a large integer through a float64, even if the binary representation is exact, causes us to end up with a rounded string representation after decoding, because the decoded number has 52-bit precision instead of the 512 we use when dealing with string representations of large integers. * update CHANGELOG.md * update to changie log --------- Co-authored-by: Austin Valle <austinvalle@gmail.com> * Update changelog * breaking: update protocol bindings for new client capabilities struct + add configure provider bindings * add Go pkg docs * add copywrite headers * add changelog * split client capabilities per RPC * added logging for req/resp deferred actions * add test for ensuring global variable is updated * add diagnostic for invalid deferred * move helper diag into function * add a separate log for nil client capabilities --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: James Bardin <j.bardin@gmail.com> Co-authored-by: hc-github-team-tf-provider-devex <github-team-tf-provider-devex@hashicorp.com>

Commit:90a82fe
Author:Benjamin Bennett
Committer:GitHub

tfprotov5+tfprotov6: Replace usage of diagnostics in CallFunction RPC with function error (#380) * tfprotov5+tfprotov6: Replace usage of diagnostics in CallFunction RPC with function error Reference: hashicorp/terraform#34603 The next version of the plugin protocol (5.5/6.5) includes support for provider defined functions. This change modifies the response returned from the CallFunction RPC, replacing diagnostics with function error. * Fix protoc version * Add changelog * Removing function argument from diagnostics * Renaming param from msg to text for function errorr * Adding change log

Commit:5206b46
Author:Brian Flad
Committer:GitHub

tfprotov5+tfprotov6: Include private state in MoveResourceState (#372) Reference: https://github.com/hashicorp/terraform/pull/34575 To match upstream changes. No changelog is necessary as this is unreleased.

Commit:bd50706
Author:Brian Flad
Committer:GitHub

tfprotov5+tfprotov6: Initial MoveResourceState support (#364) Reference: https://github.com/hashicorp/terraform-plugin-go/issues/362 Reference: https://github.com/hashicorp/terraform-plugin-go/issues/363 The next version of the plugin protocol (5.5/6.5) includes support for moving resource state. This change introduces the initial implementation of that support including: - Updated Protocol Buffers definitions - Re-generated Protocol Buffers Go code - Initial implementations of `tfprotov5` and `tfprotov6` package abstractions and wiring between those abstractions and the Protocol Buffers generated Go code - Initial implementations of `tfprotov5/tf5server` and `tfprotov6/tf6server` for the new `MoveResourceState` RPC This temporarily will not require `ProviderServer` implementations to include `MoveResourceState` implementation, however that change will occur in a subsequent release.

Commit:4179bf0
Author:Brian Flad
Committer:GitHub

tfprotov5+tfprotov6: Initial provider defined functions implementation (#351) Reference: https://github.com/hashicorp/terraform/pull/34383 Reference: https://github.com/hashicorp/terraform-plugin-go/issues/353 The next version of the plugin protocol (5.5/6.5) includes support for provider defined functions. This change introduces the initial implementation of that support including: - Updated Protocol Buffers definitions - Re-generated Protocol Buffers Go code - Initial implementations of `tfprotov5` and `tfprotov6` package abstractions and wiring between those abstractions and the Protocol Buffers generated Go code - Initial implementations of `tfprotov5/tf5server` and `tfprotov6/tf6server` for the new `GetFunctions` and `CallFunction` RPCs This temporarily will not require `ProviderServer` implementations to include `FunctionServer` implementation, however that change will occur in a subsequent release.

Commit:24e6961
Author:Brian Flad
Committer:GitHub

tfprotov5+tfprotov6: Update to protocol versions 5.4/6.4 with GetMetadata RPC and GetProviderSchemaOptional server capability (#311) Reference: https://github.com/hashicorp/terraform-plugin-go/issues/310 Protocol upgrades that impose new RPCs will either require: - The `tfprotov5.ProviderServer`/`tfprotov6.ProviderServer` interface to require a new method - Or, new "optional" interfaces be implemented (let's make up `ProviderServerWithGetMetadata` in this case) terraform-plugin-go is a low level abstraction which is designed to _directly implement_ the protocol rather than introduce its own abstractions. Most provider developers will directly interface with higher level Go modules, such as terraform-plugin-sdk and terraform-plugin-framework. Except for advanced provider development using this Go module directly, this type of low level "breaking" change will be hidden by also upgrading those Go modules at the same time: - https://github.com/hashicorp/terraform-plugin-sdk/pull/1235 - https://github.com/hashicorp/terraform-plugin-framework/pull/829 - https://github.com/hashicorp/terraform-plugin-mux/pull/186 Therefore the change is implemented on the existing interface.

Commit:dc2d28e
Author:Brian Flad

tfprotov5+tfprotov6: Add GetProviderSchema request fields for limiting resource schema data

Commit:9303150
Author:Austin Valle
Committer:GitHub

[COMPLIANCE] Add copyright and license headers (#292) * add copywrite changes * mod tidy? * add back to go mod + ignores * add --plan * add `make tools` * [COMPLIANCE] Add copyright and license headers * update protobuf GH workflow * add ignore to pb.go only * reverted back to the original protoc version * Update .copywrite.hcl Co-authored-by: Brian Flad <bflad417@gmail.com> --------- Co-authored-by: Brian Flad <bflad417@gmail.com>

Commit:c199d46
Author:Brian Flad
Committer:GitHub

tfprotov5+tfprotov6: Synchronize Protocol Buffers comments for ReadResource and UpgradeResourceState (#231) Reference: https://github.com/hashicorp/terraform/pull/31998

Commit:a494582
Author:Brian Flad
Committer:GitHub

tfprotov5+tfprotov6: Support for Protocol Version 5.3 and 6.3 (#205) Reference: https://github.com/hashicorp/terraform-plugin-go/issues/204

Commit:60a8577
Author:Brian Flad
Committer:GitHub

tfprotov6: Upgrade to Protocol Version 6.2 (#143) Reference: https://github.com/hashicorp/terraform-plugin-go/issues/142 Updated via: ```shell pushd tfprotov6/internal/tfplugin6 ./generate.sh popd ``` Terraform Plugin Protocol version 6.1 includes a deprecation of the `SchemaObject` `max_items` and `min_items` fields. While this package could transitively also deprecate the fields in its exported types, this opts to instead remove them completely since they never worked as intended. Terraform Plugin Protocol version 6.2 includes the `ApplyResourceChange.Response` and `PlanResourceChange.Response` message `legacy_type_system` field that was unintentionally missing from earlier versions. The `tfprotov6` types errantly already included the `UnsafeToUseLegacyTypeSystem` fields (copied from `tfprotov5`), which were never wired through the protocol because the protocol did not implement them. That field is now passed through the protocol in both directions.

Commit:ffa87cd
Author:Kristin Laemmert
Committer:GitHub

tfprotov6 (#71)

Commit:0b1f804
Author:Paddy Carver

Upgrade gRPC and protobuf versions. We're now generating our tfplugin5 package using libprotoc v3.13.0, protoc-gen-go v1.25.0, and protoc-gen-go-grpc v1.0. This required updating all our protocol conversions to use pointers instead of concrete values to make Go vet happy, as most request types in the generated tfplugin5 package now had sync.Mutexes in them, and go vet complained about us copying the sync.Mutex.

Commit:9ed41ba
Author:Paddy Carver
Committer:Paddy Carver

Move tfplugin5 package under tfprotov5. There's no reason to top-level the generated gRPC types, they can live under the version-specific package.

Commit:c802d9b
Author:Paddy Carver
Committer:Paddy Carver

Rough out the basic type system. This is basically just transcribing the generated gRPC types into types that we control. I still need to do the conversion for them. I changed GetSchema to GetProviderSchema, Stop to StopProvider, and Configure to ConfigureProvider, as all other RPC calls name the type of resource they're operating on. This may also provide a little forward compatibility if we introduce other plugin types to the protocol, e.g. backends. I'm still not sure how to represent state. In the gRPC generated types, it's just a *DynamicValue, which means "msgpack-encoded whatever that gets a second round of decoding", usually. So I need to figure out what it gets decoded into and replicate _that_, instead. I'm going back and forth on the Private []bytes. The protocol just requires you to echo them back, I believe, which we can do for users without them needing to deal with these weird opaque fields that they need to remember to return every time. But "minimal possible abstraction" has me questioning whether it's our place to do that or not. Representing cty is also something I need to figure out. Once again, its protocol definition is just a *DynamicValue, which only tells us that it will be decoded _again_ by the application, not what it's decoded into, which is what we want to surface. Should be easy enough to find, but it wasn't in front of my face in the protobuf definition, so I didn't include it in this pass. I have no idea why SchemaAttribute.Type is a []byte in the protobuf, and want someone to explain that to me and why it isn't, say, a string, so I can include it as a comment in the code, because that's bizarre. I made all the code happen in tfprotov5 instead of the root package or a tfproto package because I want to be able to have multiple major versions of the protocol in a single module version, so we don't have to do weird long-running branches to support v5 and v6 simultaneously if we ever have a v6. I used a system of composition to do some weird type stuff here. The ResourceServer and DataSourceServer interfaces handle all the RPC calls for a resource or a data source, respectively. This allows us to have helpers that just send resource calls to a resource type, so users don't _need_ to branch all their resources out of ApplyResourceChange or whatever. Then a ProviderServer embeds those interfaces, relying on all their methods, and adds the provider-specific ones. I also used this approach to create a BaseResourceServer, BaseDataSourceServer, and BaseProviderServer that handle their unique methods (BaseProviderServer anonymously embeds BaseResourceServer and BaseDataSourceServer) and return a "not implemented" error message. This is an idea I'm playing with for forward-compatible interfaces; a struct can anonymously embed these types, and it will automatically implement the interface, even if the interface expands underneath it. I'm not sure if this is better than a compile-time warning, or if we can provide reasonable default behavior for some or all of these methods, but it seemed like an idea worth trying.