Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to run provider with debuggers #103

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

williamhpark
Copy link
Contributor

Overview

This PR adds support for debugging tools like Delve and Goland, which should improve the debugging experience for developers contributing to the provider.

Type of change

Enhancement

Related Issue(s)

How To Test

  1. Pull the branch locally: git pull && git checkout wpark/102-debugging-support
  2. Configure a provider override in your ~/.terraformrc file, so that you use a local build of the provider rather than the published version. Refer to the documentation here for more details: https://developer.hashicorp.com/terraform/cli/config/config-file#development-overrides-for-provider-developers. Your .terraformrc file should look like this:
provider_installation {

  dev_overrides {
      "1Password/onepassword" = "<path to terraform-provider-onepassword repo root directory>"
  }

  # For all other providers, install them directly from their origin provider
  # registries as normal. If you omit this, Terraform will _only_ use
  # the dev_overrides block, and so no other providers will be available.
  direct {}
}
  1. Install Delve on your system: https://github.com/go-delve/delve/tree/master/Documentation/installation
  2. With either Delve or another debugging tool (e.g Goland), run a debugging session. Follow the instructions here, referring to the Compiling in debug mode section onward
  3. Navigate to the examples directory in your terminal. Set the TF_REATTACH_PROVIDERS variable: export TF_REATTACH_PROVIDERS=<outputted value from debugging session>
  4. Set breakpoints in your code
  5. Test creating and destroying item resources. Follow the instructions here
  • The breakpoints should be hit during the debugging session as expected

Copy link
Contributor

@volodymyrZotov volodymyrZotov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement!

@volodymyrZotov volodymyrZotov merged commit 8f6401e into main Nov 28, 2023
6 checks passed
@volodymyrZotov volodymyrZotov deleted the wpark/102-debugging-support branch November 28, 2023 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add debugging support
2 participants