TF custom provider documentation is a challenge

I’ve been writing a private provider to work around some Terraform limitations, and I am finding the usually complete documentation to be lacking.

Today for example I noticed my provider’s Update is operating on the new desired state instead of the prior state, and thus it tries to remove something that doesn’t exist. I want to understand how my code can get the prior state values to fix the bug.

When I search the web on schema.ResourceData I find nothing. The only info I can find are the sdk source code comments - where I need to know what I’m looking for beforehand.

Beyond the high level descriptions in the few pages here Home - Plugin Development: SDKv2 - Terraform by HashiCorp, is there an api reference online with more precise description of interface members, some examples, etc?

Hi @jimsnab,

Because the Terraform SDKs are just normal Go modules, we rely on the standard Go language infrastructure for distribution and for publishing documentation.

You mentioned SDKv2 specifically, which is contained in the Go module Through that Go documentation site you can find the documentation for schema.ResourceData, which it seems from your question to be the immediate thing you were looking for. With that said, in Go the documentation is derived primarily from comments in the source code, and so this may well just be a different way to look at what you already found.

If you can describe the particular challenge you’re facing then I or someone else in this forum might be able to given you a more specific pointer to the relevant information to solve it. You did mention something about updated vs. prior state, in which case ResourceData.GetChange might help here, but I can’t be sure without a little more detail about what your goal is.

Oh! That second link is hard to find. I just now notice “Directories” off in the corner that provides a random collection of stuff, and inside that stuff is the second link.

Maybe the README could be improved to make it more obvious?

Another issue - the documentation needed by a provider writer is commingled with the SDK implementation itself. It would be nice to have this more clearly separated and searchable.