A new platform for documentation and tutorials is launching soon.
We are migrating Terraform documentation into HashiCorp Developer, our new developer experience.
»Debugging SDKv2 Providers
This page contains implementation details for inspecting runtime information of a Terraform provider developed with SDKv2 via a debugger tool. Review the top level Debugging page for information pertaining to the overall Terraform provider debugging process and other inspection options, such as log-based debugging.
»Code Implementation
Update the main
function for the project to conditionally enable the plugin/ServeOpts.Debug
field. Conventionally, a -debug
flag is used to control the Debug
value.
This example uses a -debug
flag to enable debugging, otherwise starting the provider normally: