main.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright (c) HashiCorp, Inc.
  2. // SPDX-License-Identifier: MPL-2.0
  3. package main
  4. import (
  5. "context"
  6. "flag"
  7. "log"
  8. "github.com/hashicorp/terraform-plugin-framework/providerserver"
  9. "github.com/hashicorp/terraform-provider-scaffolding-framework/internal/provider"
  10. )
  11. // Run "go generate" to format example terraform files and generate the docs for the registry/website
  12. // If you do not have terraform installed, you can remove the formatting command, but its suggested to
  13. // ensure the documentation is formatted properly.
  14. //go:generate terraform fmt -recursive ./examples/
  15. // Run the docs generation tool, check its repository for more information on how it works and how docs
  16. // can be customized.
  17. //go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate -provider-name scaffolding
  18. var (
  19. // these will be set by the goreleaser configuration
  20. // to appropriate values for the compiled binary.
  21. version string = "dev"
  22. // goreleaser can pass other information to the main package, such as the specific commit
  23. // https://goreleaser.com/cookbooks/using-main.version/
  24. )
  25. func main() {
  26. var debug bool
  27. flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve")
  28. flag.Parse()
  29. opts := providerserver.ServeOpts{
  30. // TODO: Update this string with the published name of your provider.
  31. // Also update the tfplugindocs generate command to either remove the
  32. // -provider-name flag or set its value to the updated provider name.
  33. Address: "registry.terraform.io/hashicorp/scaffolding",
  34. Debug: debug,
  35. }
  36. err := providerserver.Serve(context.Background(), provider.New(version), opts)
  37. if err != nil {
  38. log.Fatal(err.Error())
  39. }
  40. }