Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit53a68cd

Browse files
authored
feat: add the option to debug the coder terraform provider (#378)
Setting the debug flag runs the provider as a standalone process and provides an environment variable that can be set for Terraform to use it. One can then attach a debugger to the provider process.
1 parentd90c181 commit53a68cd

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

‎main.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package main
22

33
import (
4+
"flag"
5+
46
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
57

68
"github.com/coder/terraform-provider-coder/v2/provider"
@@ -11,8 +13,15 @@ import (
1113
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
1214

1315
funcmain() {
14-
servePprof()
15-
plugin.Serve(&plugin.ServeOpts{
16+
debug:=flag.Bool("debug",false,"Enable debug mode for the provider")
17+
flag.Parse()
18+
19+
opts:=&plugin.ServeOpts{
20+
Debug:*debug,
21+
ProviderAddr:"registry.terraform.io/coder/coder",
1622
ProviderFunc:provider.New,
17-
})
23+
}
24+
25+
servePprof()
26+
plugin.Serve(opts)
1827
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp