Debugging terraform using Jetbrains GoLand

Start your provider in debug mode
Running your provider in plugin.Serve() mode will result to exit status 1
My provider is running in debug mode now!!!

Build our provider

%APPDATA%\terraform.d\plugins\terraform.example.com\vmaas\hpegl\1.1.1

Run terraform binary using delve debugger

Delve debugger configuration using Go Remote
run terraform provider with delve and command-line flag — debug=true
Add go build configuration to Before launch configuration of Shell Script configuration
Run the Shell script configuration
Delve debugger waiting for the remote debugger to connect
Run Go Remote configuration to start listening to our remote binary
Attaching to debugger environment variables
Attach the debugger variable and start running terraform commands

References

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store