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

Reference: https://github.com/hashicorp/terraform-provider-scaffolding-framework/issues/8
This commit is contained in:
Brian Flad 2022-03-15 11:51:54 -04:00 committed by GitHub
parent dc4be578e8
commit f1449bfe5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ package main
import ( import (
"context" "context"
"flag"
"log" "log"
"github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/tfsdk"
@ -28,7 +29,14 @@ var (
) )
func main() { 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{ opts := tfsdk.ServeOpts{
Debug: debug,
// TODO: Update this string with the published name of your provider. // TODO: Update this string with the published name of your provider.
Name: "registry.terraform.io/hashicorp/scaffolding", Name: "registry.terraform.io/hashicorp/scaffolding",
} }