Hi Justin,
If you put `TF_FORK=0` in your env, it should prevent Terraform from forking (re-exec) it’s core binary. So then you should be able to use a debugger like Delve (
https://github.com/derekparker/delve) from the command line or use your favourite editor. Unless that is vim/neovim which I use, as those don’t have debugger integration. But Atom, VSCode and Gogland (JetBrains) and likely others I don’t know do have debugging capabilities for debugging Go built into their products.
One issue you will still have is that plugins are spawn in their own process. Even if they are builtin providers, they will be started in their own process by calling the `terraform` binary with a few specific parameters which will launch the plugin instead of the core binary itself. Maybe this sounds a bit fuzzy, but without going through all the nitty gritty details this is the easiest way to describe how things work.
So it should be fairly easy to debug Terraform core, but it will be harder to debug plugins by using a debugger. I myself got used to not use a debugger since I'm working almost exclusively in Go for a few years now. Just adding some `log.Printf` statements in the right places or `pretty.Print` (
https://github.com/kr/pretty) more then often does the job just as well…