Skip to content

Commit

Permalink
feat: Add debug option to main()
Browse files Browse the repository at this point in the history
  • Loading branch information
amhn committed Sep 5, 2022
1 parent 80da35b commit f52ffe6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions examples/resources/netbox_ipam_ip_addresses/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ resource "netbox_ipam_ip_addresses" "ip_test" {
type = "multiple"
value = "0,1"
}
}
20 changes: 13 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package main

import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"flag"

"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
"github.com/smutel/terraform-provider-netbox/v4/netbox"
)
Expand All @@ -13,11 +14,16 @@ import (
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs

func main() {
opts := &plugin.ServeOpts{
ProviderFunc: func() *schema.Provider {
return netbox.Provider()
},
}
var debug bool

flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve")
flag.Parse()

opts := &plugin.ServeOpts{
Debug: debug,
ProviderAddr: "registry.terraform.io/smutel/netbox",
ProviderFunc: netbox.Provider,
}

plugin.Serve(opts)
plugin.Serve(opts)
}

0 comments on commit f52ffe6

Please sign in to comment.