2017-10-09 12:23:07 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2023-08-22 04:38:28 -05:00
|
|
|
# This is a helper script to launch OpenTF inside the "dlv" debugger,
|
2017-10-09 12:23:07 -05:00
|
|
|
# configured to await a remote debugging connection on port 2345. You can
|
|
|
|
# then connect to it using the following command, or its equivalent in your
|
|
|
|
# debugging frontend of choice:
|
|
|
|
# dlv connect 127.0.0.1:2345
|
|
|
|
#
|
|
|
|
# This tool does not install dlv. To install it, see its instructions:
|
|
|
|
# https://github.com/derekparker/delve/tree/master/Documentation/installation
|
|
|
|
#
|
|
|
|
# For more convenient use, you may wish to put this script in your PATH:
|
2023-09-20 06:35:35 -05:00
|
|
|
# ln -s ../src/github.com/opentofu/opentofu/scripts/debug-opentf $GOPATH/bin/debug-opentf
|
2017-10-09 12:23:07 -05:00
|
|
|
#
|
2023-08-27 05:34:20 -05:00
|
|
|
# Note that when running this script the OpenTF binary is NOT in $GOPATH/bin,
|
|
|
|
# so any providers installed there won't be found unless OpenTF searches
|
2017-10-09 12:23:07 -05:00
|
|
|
# there for some _other_ reason.
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2023-08-24 04:43:51 -05:00
|
|
|
echo "Launching OpenTF in a headless debug session"
|
2017-10-09 12:23:07 -05:00
|
|
|
echo "Connect to it using: dlv connect 127.0.0.1:2345"
|
2023-08-24 04:43:51 -05:00
|
|
|
echo "(OpenTF takes a long time to build and launch in this mode; some logs will appear below)"
|
2017-10-09 12:23:07 -05:00
|
|
|
echo "---------------------------"
|
|
|
|
|
2023-09-20 06:35:35 -05:00
|
|
|
exec dlv debug github.com/opentofu/opentofu --headless --listen :2345 --log -- "$@"
|