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"
|
|
|
|
|
)
|
|
|
|
|
|
2021-05-21 08:30:56 -04:00
|
|
|
// Run "go generate" to format example terraform files and generate the docs for the registry/website
|
|
|
|
|
|
|
|
|
|
// If you do not have terraform installed, you can remove the formatting command, but its suggested to
|
|
|
|
|
// ensure the documentation is formatted properly.
|
|
|
|
|
//go:generate terraform fmt -recursive ./examples/
|
|
|
|
|
|
|
|
|
|
// Run the docs generation tool, check its repository for more information on how it works and how docs
|
|
|
|
|
// can be customized.
|
|
|
|
|
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
|
|
|
|
|
|
2021-03-18 03:30:54 -04:00
|
|
|
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
|
|
|
}
|