-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmain.go
48 lines (40 loc) · 1.08 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"context"
"flag"
"log"
sdkprovider "github.com/brightbox/terraform-provider-brightbox/brightbox"
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
"github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server"
"github.com/hashicorp/terraform-plugin-mux/tf5muxserver"
)
var (
// these will be set by the goreleaser configuration
// to appropriate values for the compiled binary.
version string = "dev"
)
func main() {
debugFlag := flag.Bool("debug", false, "Start provider in debug mode.")
flag.Parse()
opts := []tf5server.ServeOpt{}
if *debugFlag {
opts = append(opts, tf5server.WithManagedDebug())
}
providers := []func() tfprotov5.ProviderServer{
//providerserver.NewProtocol5(provider.New(version)),
sdkprovider.Provider().GRPCProvider,
}
// use the muxer
muxServer, err := tf5muxserver.NewMuxServer(context.Background(), providers...)
if err != nil {
log.Fatalf(err.Error())
}
err = tf5server.Serve(
"registry.terraform.io/brightbox/brightbox",
muxServer.ProviderServer,
opts...,
)
if err != nil {
log.Fatal(err.Error())
}
}