-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into bmm/update-use-cases
- Loading branch information
Showing
62 changed files
with
3,687 additions
and
1,633 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ label to enable the backport bot. | |
--> | ||
|
||
1.10.x | ||
1.11.x | ||
|
||
## Draft CHANGELOG entry | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# How to Debug Terraform | ||
|
||
As Terraform is written in Go you may use [delve](https://github.com/go-delve/delve) to debug it. | ||
|
||
## 1. Compile & Start Debug Server | ||
|
||
One way to do it is to compile a binary with the [appropriate compiler flags](https://pkg.go.dev/cmd/compile#hdr-Command_Line): | ||
|
||
```sh | ||
go install -gcflags="all=-N -l" | ||
``` | ||
|
||
This enables you to then execute the compiled binary via delve, pass any arguments as spin up a debug server which you can then connect to: | ||
|
||
```sh | ||
dlv exec $GOBIN/terraform --headless --listen :2345 --log -- apply | ||
``` | ||
|
||
## 2a. Connect via CLI | ||
|
||
You may connect to the headless debug server via delve CLI | ||
|
||
```sh | ||
dlv connect :2345 | ||
``` | ||
|
||
## 2b. Connect from VS Code | ||
|
||
The repository provides a launch configuration, making it possible to use VS Code's native debugging integration: | ||
|
||
![vscode debugger](./images/vscode-debugging.png) | ||
|
||
Note that this debugging workflow is different from the test-based one, which itself shouldn't require any of the above steps above nor the mentioned launch configuration. Meaning, that if you already have a test that hits the right lines of code you want to be debugging, or you can write one, then that may be an easier workflow. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.