Skip to content

Commit 7259769

Browse files
authored
feat: add config & docs for easier contributing (#604)
Signed-off-by: Nathanael Liechti <[email protected]>
1 parent 89996a1 commit 7259769

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ terraform-provider-argocd
22
/manifests/install/argocd.yml
33
/bin
44
.idea
5-
.vscode
5+
66
# Env variables settings
77
/scripts/testacc
88
/scripts/testacc_prepare_env
99

1010
# debug build
11-
__debug_bin
11+
__debug_bin*
12+
13+
# local reproduction folders
14+
reproduce/

.vscode/launch.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Debug Terraform Provider",
6+
"type": "go",
7+
"request": "launch",
8+
"mode": "debug",
9+
"program": "${workspaceFolder}",
10+
"env": {},
11+
"args": [
12+
"-debug"
13+
]
14+
},
15+
{
16+
"name": "Debug Selected Test",
17+
"request": "launch",
18+
"type": "go",
19+
"args": [
20+
"-test.v",
21+
"-test.run",
22+
"^${selectedText}$"
23+
],
24+
"mode": "auto",
25+
"program": "${fileDirname}",
26+
"env": {
27+
"PKG_NAME": "${relativeFileDirname}",
28+
"TF_ACC": "1",
29+
"TF_LOG": "info",
30+
"ARGOCD_INSECURE": "true",
31+
"ARGOCD_SERVER": "127.0.0.1:8080",
32+
"ARGOCD_AUTH_USERNAME": "admin",
33+
"ARGOCD_AUTH_PASSWORD": "acceptancetesting"
34+
},
35+
"showLog": true
36+
}
37+
]
38+
}

CONTRIBUTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@ Then, setup your environment following [these
5353
instructions](https://www.terraform.io/plugin/debugging#terraform-cli-development-overrides)
5454
to make your local terraform use your local build.
5555

56+
## Debugging
57+
58+
Hasicorp Docs: https://developer.hashicorp.com/terraform/plugin/debugging#starting-a-provider-in-debug-mode
59+
60+
### Running the Terraform provider in debug mode
61+
62+
In VS Code open the Debug tab and select the profile "Debug Terraform Provider". Set some breakpoints and then run this task.
63+
64+
Then head to the debug console and copy the line where it says `TF_REATTACH_PROVIDERS` and copy it.
65+
66+
Now that your provider is running in debug-mode in VS Code, you can head to any terminal where you want to run a Terraform stack and prepend the terraform command with the copied text. The Terraform CLI will then ensure it's using the provider already running inside VS Code.
67+
68+
### Running acceptance tests in debug mode
69+
70+
Open a test file, hover over a test function name and in the Debug tab hit "Debug selected Test". You shouldn't use the builtin "Debug Test" profile that is shown when hovering over a test function since it doesn't contain the necessary configuration to find your Argo CD environment.
71+
5672
## Troubleshooting during local development
5773

5874
* **"too many open files":** Running all acceptance tests in parallel (the

0 commit comments

Comments
 (0)