2017-06-05 16:59:08 -04:00
|
|
|
package main
|
|
|
|
|
|
2017-06-06 11:50:36 -04:00
|
|
|
import (
|
2021-03-18 03:30:54 -04:00
|
|
|
"context"
|
|
|
|
|
"flag"
|
|
|
|
|
"log"
|
|
|
|
|
|
|
|
|
|
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
|
|
|
|
|
"github.com/terraform-providers/terraform-provider-docker/internal/provider"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
// these will be set by the goreleaser configuration
|
|
|
|
|
// to appropriate values for the compiled binary
|
|
|
|
|
version string = "dev"
|
|
|
|
|
|
|
|
|
|
// goreleaser can also pass the specific commit if you want
|
|
|
|
|
// commit string = ""
|
2017-06-06 11:50:36 -04:00
|
|
|
)
|
|
|
|
|
|
2017-06-05 16:59:08 -04:00
|
|
|
func main() {
|
2021-03-18 03:30:54 -04:00
|
|
|
var debugMode bool
|
|
|
|
|
|
|
|
|
|
flag.BoolVar(&debugMode, "debug", false, "set to true to run the provider with support for debuggers like delve")
|
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
|
|
opts := &plugin.ServeOpts{ProviderFunc: provider.New(version)}
|
|
|
|
|
|
|
|
|
|
if debugMode {
|
|
|
|
|
err := plugin.Debug(context.Background(), "registry.terraform.io/kreuzwerker/terraform-provider-docker", opts)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err.Error())
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
plugin.Serve(opts)
|
2017-06-05 16:59:08 -04:00
|
|
|
}
|