You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cannot find how to do both: run an acceptance test with TF_ACC=1 TF_DEBUG=INFO go test -v -run MyResourceCRUD . and get debugger support (e.g. breakpoints) in the provider code.
Extras
With TF_LOG=TRACE I can see multiple debug statements "Setting Terraform CLI reattach configuration", but apparently these are triggered by the provider instantiantion by the acceptance test driver (e.g. with ProtoV6ProviderFactories somewhere in the call stack), and I see no option to override.
Caveat: env and envFile seem to be ignored in my case (vscode on windows, running/debugging in WSL2), had to set my auth environment variables via .vscode/settings.json (go.testEnvFile)
Hey @azrdev 👋🏻, looks like you resolved your issue so I'm going to close this out.
I think what's out there should be sufficient, although if you have specific doc suggestions feel free to point them out. Any way that you get the TF_ACC environment variable populated in your test runner should work fine. Personally, I use VSCode and have my global user settings with go.testEnvVars like:
Although, most provider test debugging I'm doing is with providers that don't need credentials, so go.testEnvFile is also appropriate. I'd imagine using a project/workspace settings.json would lean towards using an env file, where you could define more "global" env variables in your user settings.json.
Does this documentation exist?
Where would you expect to find this documentation?
Details
https://developer.hashicorp.com/terraform/plugin/framework/acctests describes how to write and run (
TF_ACC=1
) acceptance tests for terraform providers using the plugin framework.https://developer.hashicorp.com/terraform/plugin/framework/debugging and https://developer.hashicorp.com/terraform/plugin/debugging#starting-a-provider-in-debug-mode describe how to start a provider server in a debugger (e.g. delve), and export its address using
TF_REATTACH_PROVIDERS
to any terraform commands run afterwards, enabling debugger support for the provider code.I cannot find how to do both: run an acceptance test with
TF_ACC=1 TF_DEBUG=INFO go test -v -run MyResourceCRUD .
and get debugger support (e.g. breakpoints) in the provider code.Extras
With
TF_LOG=TRACE
I can see multiple debug statements "Setting Terraform CLI reattach configuration", but apparently these are triggered by the provider instantiantion by the acceptance test driver (e.g. withProtoV6ProviderFactories
somewhere in the call stack), and I see no option to override.Description
References
The text was updated successfully, but these errors were encountered: