- What version of Delve are you using (
dlv version
)?
Delve Debugger
Version: 0.11.0-alpha
Build: 26ce16f1db3fdd6fdd915f2ec7d11e4bfe72baed
- What version of Go are you using? (
go version
)?
go version go1.6 darwin/amd64
- What operating system and processor architecture are you using?
OS X
- What did you do?
I tried to debug hashicorp/terraform application.
$ dlv debug github.com/hashicorp/terraform -- apply
Type 'help' for list of commands.
(dlv) c
- What did you expect to see?
I expected to debugger to be able to find the other plugins that Terraform depends.
- What did you see instead?
Error configuring: 3 error(s) occurred:
* triton_firewall_rule.inet-to-bastion: provider triton couldn't be found
* triton_firewall_rule.bastion-to-vms: provider triton couldn't be found
* triton_machine.bastion: provider triton couldn't be found
Process 40980 has exited with status 1
For @farvour and anyone else looking for an answer: This is quite a late reply, but I thought I’d drop in and say: providers are actually one of the easier things to debug in Terraform with Delve!
The key to doing it is to debug it through Delve’s
test
functionality, through an acceptance test. Write an acceptance test for the scenario that you want to test on, if one does not exist already.Then, run:
The key to remember is that since you have to pass your test arguments over to the actual test binary directly instead of proxying them with
go test
, prefixing your test-specific arguments withtest.
is necessary after the--
terminator.In the debugger, set your breakpoints,
continue
, and debug away!In some of the providers I have worked on, you will see a
debugacc
make target that helps with this a bit, although you will still need to supply the-test.run=
to run a specific test:@vancluever
This should be fixed on master for OSX.
I just returned from Hashicon and got a tip from the core Terraform team (they use delve too!). This is how I got debugging to work with Terraform:
NOTE: this technique only works with Terraform core. Debugging the Terraform plug-ins is still an issue.
The key is setting the above environment variable. I won’t even try to pretend explaining why this works, but you can find where I got the mysterious values from here: https://github.com/mitchellh/panicwrap/search?utf8=✓&q=DEFAULT_COOKIE_KEY