terraform-provider-rabbitmq icon indicating copy to clipboard operation
terraform-provider-rabbitmq copied to clipboard

feat: add provider debug flag

Open mcwarman opened this issue 1 year ago • 0 comments

Allows for remote debugging of the terraform provider.

Was looking into #52 (which should be fixable if https://github.com/michaelklishin/rabbit-hole/pull/280 is merged) and added this useful snippet in order to debug it.

References:

  • https://developer.hashicorp.com/terraform/plugin/debugging
  • https://developer.hashicorp.com/terraform/plugin/sdkv2/debugging

Usage

make build
$GOBIN/terraform-provider-rabbitmq --debug # or use IDE remote debugging (see below)
TF_REATTACH_PROVIDERS='...' terraform plan # TF_REATTACH_PROVIDERS copied from output above
vscode debugging

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug Terraform Provider",
      "type": "go",
      "request": "launch",
      "mode": "debug",
      "program": "${workspaceFolder}",
      "env": {},
      "args": [
        "-debug",
      ]
    }
  ]
}

mcwarman avatar Aug 21 '23 08:08 mcwarman