I have an existing client for my SDK written in Go that has all the types of all the resources already defined.
This is a REST API, so all the types are basically unmarshalled JSON
This seems like a rudimentary task but I couldn’t find it anywhere in the docs
Is it possible to derive the schema types of resources and data sources from existing Go types ? I would like to avoid having to maintain multiple schemas of the same API when I already have it defined
Hi @omercnet Thank you for raising this topic and welcome to HashiCorp Discuss.
Is the Go-based SDK based off another definition, such as OpenAPI? If not, parsing the SDK into its Abstract Syntax Tree (AST) is likely required before it can be translated into a Terraform Provider schema definition. Linking various AST concepts together may seem simple on the surface, but there may be a bit of additional nuance to the process that would make it difficult to translate without providing some Terraform-specific configuration along the way. It’s hard to discuss these without knowing the full situation though.
yes, it’s based on protobuf, with a solid openapi schema
I understand you’re still working on this - would love to participate in the early experiments to help us move faster