-
Notifications
You must be signed in to change notification settings - Fork 99
Description
Currently, a lot of logic is living in the tfsdk/serve.go file. It's basically gluing together all the abstractions and helpers in the framework, and it's where the magic happens. It also is what surfaces a gRPC server that Terraform can connect to.
I think having those two concerns colocated is probably a bit of technical debt. Doing so means that testing the magic needs to be tested at the gRPC level. It also means that code to mutate values and call helpers is living right next to code that converts between the framework's types and the gRPC server's.
I think we could make the methods on the server thin wrappers around calls with more narrow function signatures and requirements, and that would allow us to write more tests more easily, because we wouldn't need to implement an entire provider to integration test against. The server methods would just be responsible for converting from gRPC types into framework types, calling these functions, and converting back. The functions would just be responsible for the mutation and calling other helpers/calling into the framework injection points.
I think this would make it a little easier to navigate, test, and understand the codebase.