I also have this opened as a github issue
This is my first time developing a Packer builder and I’m trying to debug an issue in my code. With Terraform Provider development I have a setup for vscode debuging which exposes runtime variables and allows me to declare break points, step into / over /out of functions, etc.
Using the below launch.json I can run a test in debug mode. However, its not finding my plugin:
2024/04/09 16:09:46 ui error: Error: Unknown source type harvester-img
on ./harvester_builder_basic_test.pkr.hcl line 10:
(source code not available)
known builders: [docker googlecompute virtualbox-ovf qemu amazon-ebssurrogate
amazon-ebs amazon-ebsvolume virtualbox-iso vagrant azure-dtl vsphere-clone
azure-chroot amazon-chroot file vsphere-iso vmware-iso vmware-vmx
amazon-instance null azure-arm virtualbox-vm]
Launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch a test function",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"env": { "PACKER_ACC": "true"},
"args": [
"-test.v",
"-test.run",
"^${selectedText}$"
],
"showLog": true
}
]
}
This seems to indicate to me that its looking for a pre-compiled binary… so if i add the PACKER_PLUGIN_PATH
it can find the binary. HOWEVER, then its not actually using my source which means it doesnt respect break points…
"env": { "PACKER_ACC": "true", "PACKER_PLUGIN_PATH": "${workspaceFolder}/"},
Yall have any idea how i can configure VSCode to compile this as part of the test run and use break points, etc?