Browse Source

main: Add -debug flag for enabling debugger support (#27)

Reference: https://github.com/hashicorp/terraform-provider-scaffolding-framework/issues/8
Brian Flad 3 years ago
parent
commit
f1449bfe5c
1 changed files with 8 additions and 0 deletions
  1. 8 0
      main.go

+ 8 - 0
main.go

@@ -2,6 +2,7 @@ package main
 
 import (
 	"context"
+	"flag"
 	"log"
 
 	"github.com/hashicorp/terraform-plugin-framework/tfsdk"
@@ -28,7 +29,14 @@ var (
 )
 
 func main() {
+	var debug bool
+
+	flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve")
+	flag.Parse()
+
 	opts := tfsdk.ServeOpts{
+		Debug: debug,
+
 		// TODO: Update this string with the published name of your provider.
 		Name: "registry.terraform.io/hashicorp/scaffolding",
 	}