Custom Terraform Provider API Client Confusion

Hello,

I thought it would be a fun project to try the new OpenAPI generator tools to create a custom provider. The idea will be to get terraform working with a private internal rest api. I have successfully created a provider spec file and turned that spec file into a provider, resource and datasource (go files).

I’m a bit confused on how terraform knows how to talk to my rest api. the generated provider doesn’t seem to know that it needs to login using a username and password to retreive a token. The generated datasource seems to know all about the data types but not that its located at /api/vi/my-thingy.

After running through the hashicups and petstore examples it seems that I need to make some kind of api client that knows how to talk to my rest api. I kinda thought thats what I was doing with openapi?

I asked google gemini to help me and I now have an “internal/myapiclient/client.go” which I was able to figure out how to login and get a token and a datasource that can locate a user.

It took all of 10 minutes (not including the tutorials) to generate all the code but this api client seems like its going be the bulk of the work. Have I missed a step? If this is not handled by tfplugingen-framework or tfplugingen-openapi how should I proceed? There do seem to be tools that will generate a go client from openapi. will that generate the right kind of thing?

Thanks in advance.