mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-18 14:56:17 -05:00
This fixes the following error that shows up if you run the provider in
debug mode:
```json
{"@level":"info","@message":"2022/09/21 15:25:08 [ERROR] Error parsing provider name \"registry.terraform.io/kreuzwerker/terraform-provider-docker\": Invalid provider type: Provider source \"kreuzwerker/terraform-provider-docker\" has a type with the prefix \"terraform-provider-\", which isn't valid. Although that prefix is often used in the names of version control repositories for Terraform providers, provider source strings should not include it.\n\nDid you mean \"kreuzwerker/docker\"?","@timestamp":"2022-09-21T15:25:08.353718-04:00"}
```
44 lines
1.3 KiB
Go
44 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
|
|
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
|
|
"github.com/terraform-providers/terraform-provider-docker/internal/provider"
|
|
)
|
|
|
|
// 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
|
|
|
|
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 = ""
|
|
)
|
|
|
|
func main() {
|
|
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 {
|
|
debugOpts := &plugin.ServeOpts{ProviderFunc: provider.New(version), ProviderAddr: "registry.terraform.io/kreuzwerker/docker", Debug: true}
|
|
plugin.Serve(debugOpts)
|
|
return
|
|
}
|
|
|
|
plugin.Serve(opts)
|
|
}
|