github.com/kevinklinger/open_terraform@v1.3.6/scripts/debug-terraform (about) 1 #!/usr/bin/env bash 2 3 # This is a helper script to launch Terraform inside the "dlv" debugger, 4 # configured to await a remote debugging connection on port 2345. You can 5 # then connect to it using the following command, or its equivalent in your 6 # debugging frontend of choice: 7 # dlv connect 127.0.0.1:2345 8 # 9 # This tool does not install dlv. To install it, see its instructions: 10 # https://github.com/derekparker/delve/tree/master/Documentation/installation 11 # 12 # For more convenient use, you may wish to put this script in your PATH: 13 # ln -s ../src/github.com/hashicorp/terraform/scripts/debug-terraform $GOPATH/bin/debug-terraform 14 # 15 # Note that when running this script the Terraform binary is NOT in $GOPATH/bin, 16 # so any providers installed there won't be found unless Terraform searches 17 # there for some _other_ reason. 18 19 set -eu 20 21 echo "Launching Terraform in a headless debug session" 22 echo "Connect to it using: dlv connect 127.0.0.1:2345" 23 echo "(Terraform takes a long time to build and launch in this mode; some logs will appear below)" 24 echo "---------------------------" 25 26 exec dlv debug github.com/hashicorp/terraform --headless --listen :2345 --log -- "$@"