Commit graph

71 commits

Author SHA1 Message Date
Sarah French
2e5b5dee5d
Upgrade protoc and protoc-gen-go-grpc versions to matching terraform-plugin-go (#37647)
Some checks failed
build / Build for freebsd_amd64 (push) Has been cancelled
build / Build for linux_amd64 (push) Has been cancelled
build / Build for openbsd_amd64 (push) Has been cancelled
build / Build for solaris_amd64 (push) Has been cancelled
build / Build for windows_amd64 (push) Has been cancelled
build / Build for freebsd_arm (push) Has been cancelled
build / Build for linux_arm (push) Has been cancelled
build / Build for darwin_arm64 (push) Has been cancelled
build / Build for linux_arm64 (push) Has been cancelled
build / Build for windows_arm64 (push) Has been cancelled
build / Build Docker image for linux_386 (push) Has been cancelled
build / Build Docker image for linux_amd64 (push) Has been cancelled
build / Build Docker image for linux_arm (push) Has been cancelled
build / Build Docker image for linux_arm64 (push) Has been cancelled
build / Build e2etest for linux_386 (push) Has been cancelled
build / Build e2etest for windows_386 (push) Has been cancelled
build / Build e2etest for darwin_amd64 (push) Has been cancelled
build / Build e2etest for linux_amd64 (push) Has been cancelled
build / Build e2etest for windows_amd64 (push) Has been cancelled
build / Build e2etest for linux_arm (push) Has been cancelled
build / Build e2etest for darwin_arm64 (push) Has been cancelled
build / Build e2etest for linux_arm64 (push) Has been cancelled
build / Run e2e test for linux_386 (push) Has been cancelled
build / Run e2e test for windows_386 (push) Has been cancelled
build / Run e2e test for darwin_amd64 (push) Has been cancelled
build / Run e2e test for linux_amd64 (push) Has been cancelled
build / Run e2e test for windows_amd64 (push) Has been cancelled
build / Run e2e test for linux_arm (push) Has been cancelled
build / Run e2e test for linux_arm64 (push) Has been cancelled
build / Run terraform-exec test for linux amd64 (push) Has been cancelled
* Update protoc version in downloader script

* go get google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1

This matched terraform-plugin-go

* make protobuf

* Run `make protobuf`

* Update generator to handle generic types from google.golang.org/grpc

Looks like this was added in v1.69.3 in https://github.com/grpc/grpc-go/pull/7057 ?

* Run `make generate`

* Fix "cannot infer Res" compile error - more usage of generics

* More fixing compile errors due to switching to use of a generic

* Make putting `google.golang.org/grpc` import into generated files conditional

* Run `make generate`

* Update more places where generics now need to be used

* Update generator to handle any types from google.golang.org/grpc in same switch case.
2025-10-22 14:46:18 +01:00
Sarah French
2657a4daec
Set let require_unimplemented_servers default to true when generating code from .proto files (#37737)
* Remove `require_unimplemented_servers=false` option when generating code from proto files. Run `make protobuf`.

This allows require_unimplemented_servers to default to true, and the generated code shows the impacts of that.

* Update generator script to embed 'UnimplementedFoobarServer' structs and skip generating code for the `mustEmbedUnimplementedFoobarServer` method that is implemented via that embedding.

* Run `make generate`

* Embed UnimplementedProviderServer into implementations of ProviderServer

* Embed UnimplementedProvisionerServer into implementations of ProvisionerServer
2025-10-09 11:18:13 +01:00
Sarah French
ffbb62b369
Swap to using google.golang.org/protobuf/cmd/protoc-gen-go instead of github.com/golang/protobuf/protoc-gen-go (#37685)
* Reformat Args in steps definitions

* Swap to using the new version of protoc-gen-go that doesn't include grpc support (instead it relies on protoc-gen-go-grpc).

Update command flags to reflect this change in tooling.

See this comment for explanation: https://github.com/golang/protobuf/issues/1070#issuecomment-607293496

* Run `make protobuf` with problem generate steps commented out.

* Use `require_unimplemented_servers=false` to minimise changes at the time of upgrading tooling

In future we can navigate the consequences of this in its own PR.

* WIP

* Fix out/opt typo, add remaining flags once terraform1.proto was being found ok

* Run `make protobuf`

* `go get google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0` && `go mod tidy`

This version includes a feature that allows the copyright comment in the .proto file to be pulled across to generated _grpc.pb.go files.

* Run `make protobuf` with new version of protoc-gen-go-grpc that allows copyright comment to be copied to generated output files

* Potential fix for `internal/rpcapi/dynrpcserver/generator`
2025-09-30 11:52:24 +01:00
Daniel Schmidt
871451122f actions: move schema to single action type and remove linked resources
we want to leave the door open to evolve the design in the future based on feedback
2025-09-15 17:09:22 +02:00
James Bardin
db98d67774 GenerateResourceConfig protobuf 2025-08-29 15:00:30 -04:00
Daniel Schmidt
176263d936 actions: remove future action types
removing them for now, this gives us more flexibility in the future since the schema is not yet locked in
2025-08-29 16:25:41 +02:00
James Bardin
7ed24d208a make protobuf 2025-08-12 14:05:10 -04:00
Daniel Schmidt
17e7338b0f add client capabilites across the board 2025-08-05 15:34:13 +02:00
Austin Valle
184175761b fix protocol field numbers 2025-07-30 09:59:46 +02:00
Daniel Schmidt
7bf6629ae7 fix protobuf typo 2025-07-24 11:28:29 +02:00
Daniel Schmidt
c11a85493e mark field 10 as reserved
Co-authored-by: Liam Cervante <liam.cervante@hashicorp.com>
2025-07-24 11:28:29 +02:00
Daniel Schmidt
972427d70a use same attribute mapping as provider protocol 2025-07-24 11:28:29 +02:00
Kristin Laemmert
0374f04424
Add ValidateActionConfig to provider interface, protocol & internal implementations (#37345)
* Add ValidateActionConfig to provider interface and protocol

* Update internal/provider-simple-v6/provider.go

Co-authored-by: Daniel Schmidt <danielmschmidt92@gmail.com>

---------

Co-authored-by: Daniel Schmidt <danielmschmidt92@gmail.com>
2025-07-18 14:14:44 -04:00
Daniel Schmidt
e6b848d5ab add actions protobuf definitions 2025-07-10 16:06:44 +02:00
Samsondeen
79187d579d
Validate list block meta-arguments (#37281) 2025-07-04 10:42:06 +02:00
Daniel Banck
cb58a15f3d
Implement ListResource RPC (TF-25509) (#37092)
* Implement ListResource RPC via callbacks

* Implement ListResource with iterators

* Change `ListResourceResponse` to slice

* Turn ListResourceResponse into a struct

* Add a limit for ListResource

* explicitly cancel stream when listing resources

---------

Co-authored-by: Samsondeen Dare <samsondeen.dare@hashicorp.com>
2025-06-04 09:40:10 +02:00
Radek Simko
dd4bf55dca
docs/plugin-protocol: Clarify use of GetMetadata (#37181)
* docs/plugin-protocol: Clarify use of GetMetadata

* Run `make protobuf`

---------

Co-authored-by: Sarah French <sarah.french@hashicorp.com>
2025-06-02 09:18:39 +01:00
Baraa Basata
d8d890f3b2
Minimize text diff between tfplugin{5,6}.proto (#37093)
* Minimize text diff between tfplugin{5,6}.proto

This is a no-op change that moves two definitions in tfplugin5.proto to
match their relative location in tfplugin6.proto. The effect is to
remove an incidental part of the text diff between the two files for
easier comparison.

* fixup! Minimize text diff between tfplugin{5,6}.proto
2025-05-21 18:15:27 +02:00
Daniel Banck
44ae7da18e
Update Plugin Protocol for List and Implement ValidateListResourceConfig (#37007)
* Minor auto-formatting changes

* Add list RPC and schema protobuf definitions

* make protobuf

* make generate

* Add ValidateListResourceConfig implementation
2025-05-19 10:20:52 +02:00
Daniel Banck
dd10cfc048
Cleanup Terraform Plugin Protocol Files (#37005)
* Rename tfplugin5.9.proto and remove other files

* Rename tfplugin6.9.proto and remove other files

* Update symlinks

* Update protocol related docs
2025-05-09 15:23:38 +02:00
Sarah French
6ef0498f9c
Update to Go 1.24.1, update dependencies (#36790)
* go get github.com/hashicorp/go-azure-helpers@v0.72.0

* .go-version to 1.24.1

* Run `./scripts/syncdeps.sh`

This propagates the Go version upgrade

* gcs : go get google.golang.org/api@v0.155.0

* gcs: go mod tidy

* Run `./scripts/syncdeps.sh`

* make generate && make protobuf
2025-03-27 17:15:46 +00:00
Sarah French
a04664a2e5
Update hashicorp/go-plugin dependency (#36561)
* go get github.com/hashicorp/go-plugin

* ./scripts/syncdeps.sh

* make protobuf
2025-03-26 12:09:01 +00:00
Daniel Banck
5b48de5a4e
Update identity related fields in protocol move request (#36662)
* Update source identity type in move request

* make protobuf

* Update type for identity upgrade

* make protobuf
2025-03-10 18:00:29 +01:00
Daniel Banck
857d188308
Add resource identity message to protocol (TF-23178) (#36451)
* protocol: create new 5.9 and 6.9 protocol versions

* protocol: add resource identity messages to 5.9 & 6.9

* make protobuf

* make generate

* grpcwrap: Add RPC calls skeleton
2025-02-10 16:31:50 +01:00
Daniel Schmidt
e29708c4d9
ephemeral: add WriteOnlyAttributesAllowed client capability to validate resource 2024-12-18 09:30:32 +01:00
Daniel Schmidt
3a962e8e7e
ephemeral: add WriteOnlyAttributesAllowed client capability
we allow it for all requests
2024-12-12 10:56:40 +01:00
Daniel Schmidt
50b3732f72
write-only attributes: add to provider schema 2024-11-12 16:42:05 +01:00
James Bardin
9899d59a22 add deferrals to ephemeral proto and remove state
Add deferrals to the protocol.
The renew and close calls had an extra state field which was unneeded.
2024-09-30 10:49:52 -04:00
James Bardin
9c3dc8f73a ephemeral protocol rename
Add `Resource` to all the ephemeral protocol symbols to make them
consistent with existing naming conventions.
2024-09-20 11:08:53 -04:00
James Bardin
c5ecab5b19 generate new protobuf code 2024-09-19 10:02:45 -04:00
James Bardin
9ff727440e udpate generated files 2024-09-11 14:09:42 -04:00
Liam Cervante
055dd27e53
deferred actions: implement latest provider protocol changes (#35063) 2024-04-24 14:10:08 +02:00
Daniel Schmidt
45e9530d12
stacks: remove deferred actions for UpgradeResourceState
UpgradeResourceState is offline; it does not need a configured provider

therefore it can not be deferred
2024-03-26 17:34:24 +01:00
Daniel Schmidt
71873ec29a
fix comment 2024-03-26 17:32:46 +01:00
Daniel Schmidt
e650c039ef
stacks: add deferred to protobuf 2024-03-25 16:12:41 +01:00
Daniel Schmidt
4e8a8fa883
add new tfplugin version
in preparation for adding fields related to deferred actions
2024-03-25 16:10:27 +01:00
Martin Atkins
d3b8a55781 go.mod: go get google.golang.org/protobuf@v1.33.0
Many of the changes between these two versions seem to be in parts of the
library that Terraform doesn't use, but there are a few sensitive parts:
  - Slight changes to details of how the library implements the JSON
    encoding of protobuf. Terraform CLI/Core don't use this, but some
    of the backends might use it indirectly when talking to their
    underlying APIs.
  - Some details of the "protoreflect" package for working with
    protobuf descriptors dynamically (rather than using generated stubs)
    have changed, but it seems pretty marginal and unlikely to cause
    problems.
2024-03-21 08:05:58 -07:00
James Bardin
300f66b71d
Merge pull request #34603 from hashicorp/jbardin/remove-provider-funtion-warnings
provider functions can only return an error
2024-02-27 09:53:48 -05:00
Radek Simko
0c509183d1
ci: Add test for license headers (#34624)
* ci: Add test for copyright headers

* replace GHA workflow with make target (copyright)

This makes it reusable for outside of CI, such that anyone cloning the repo locally can still easily verify compliance before raising a PR.

* remove go:generate for copywrite

This should no longer be needed as we leverage copywrite via a shell script now.

* introduce make copyrightfix
2024-02-14 07:53:39 +00:00
James Bardin
a8701f6ddd provider functions return an error
The call site for language functions doesn't currently have a way to
handle complex diagnostics, so rather than appear to support them in the
protocol we remove the concepts of diagnostics for now. We do however
retain the argument index fields, which we can wrap in a
function.ArgError and get a little more precise hcl diagnostic from
expression.
2024-02-01 09:26:51 -05:00
Brian Flad
c7a44bfc9a
Support Private State with MoveResourceState (#34575)
This change ensures that providers receive the source private state and can store potentially differing private state as part of a move, rather than always copying the source private state to the target. This functionality has not yet been released and therefore there are no compatibility concerns.
2024-01-26 07:46:31 -05:00
Liam Cervante
7d143388f3
Add support for the cross resource type move operation in the proto schema (#34480)
* Update proto schema and provider interfaces with support for moved across resource type RPCs

* address comments

* remove unused functions

* remove support for flatmap format
2024-01-11 10:08:50 +01:00
hc-github-team-es-release-engineering
6114ec4390
Merge pull request #34367 from hashicorp/RELPLAT-955-EOY-license-updates
[DO NOT MERGE UNTIL EOY] EOY license updates
2024-01-02 09:20:56 -08:00
James Bardin
c439b72599 proto: add provider-defined functions 2023-12-08 15:25:26 -05:00
hc-github-team-es-release-engineering
a90ba0bfe4 update year in license files 2023-12-06 11:58:53 -08:00
CJ Horton
813369f317 stick with go generate check instead 2023-08-30 14:25:49 -07:00
Brian Flad
7094517089
Add GetMetadata RPC to provider protocol (#33739)
Reference: https://github.com/hashicorp/terraform/pull/33486

This is a followup to the new provider server capability to make the `GetProviderSchema` RPC optional. While this server capability would perform its intended function when directly talking to a single provider server SDK implementation, provider servers using terraform-plugin-mux need a methodology for the mux server to determine the available resource types of each underlying provider server to properly route resource-specific RPCs. Since the only methodology available to the mux server would be calling the `GetProviderSchema` RPC to each of underlying provider servers, any memory optimization of core caching would be lost.

The choice of adding a new RPC instead of adjusting the existing `GetProviderSchema` RPC with additional request information, such as "only list the type names and not the schema information in the response", is two-fold:

- Prevents the introduction of conditional logic for the existing RPC.
- Clearly delineates the purpose of the RPC and can be documented easier.

The choice of adding this to the existing provider service is two-fold:

- Implementing a separate protocol and/or service only on the provider side of the protocol would be a novel design change. This small of a change does not warrant the potential research and testing effort that would be associated with that implementation.
- While the core implementation will not use the new RPC immediately, there is no reason why it should be restricted from doing so in the future if a valid use case surfaces. Other ecosystem tools, beyond terraform-plugin-mux, can also potentially benefit from the lightweight RPC now.

This is changing the 5.4 and 6.4 protocol versions following the guidance of this comment in the definition files, since it directly relates to the prior intention of the new minor versions:

```protobuf
// Note that only the proto files included in a release tag of Terraform are
// official protocol releases. Proto files taken from other commits may include
// incomplete changes or features that did not make it into a final release.
// In all reasonable cases, plugin developers should take the proto file from
// the tag of the most recent release of Terraform, and not from the main
// branch or any other development branch.
```

As with any Protocol Buffers definition update, protocol compatibility is guaranteed within a major version, however generated protocol source code compatibility is not guaranteed. In this case, implementing the new RPC method in protocol wrapper types and the moving of the `ServerCapabilities` message to the top namespace are considered acceptable changes.
2023-08-24 14:35:42 -04:00
CJ Horton
c09daa7dc7 update license for provider plugin protocol files 2023-08-16 11:21:41 -07:00
hashicorp-copywrite[bot]
53c34ff49c
Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
James Bardin
f5d94b35a0
Merge pull request #33486 from hashicorp/jbardin/schema-cache-proto
enable schema caching and add `get_provider_schema_optional` server capability
2023-07-18 11:18:11 -04:00