-
Notifications
You must be signed in to change notification settings - Fork 70
/
main.go
54 lines (42 loc) · 1.09 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
49
50
51
52
53
54
package main
import (
"context"
"flag"
"log"
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
"github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server"
"github.com/aiven/terraform-provider-aiven/internal/server"
)
//go:generate go run ./ucgenerator/... --excludeServices alloydbomni
// registryPrefix is the registry prefix for the provider.
const registryPrefix = "registry.terraform.io/"
// version is the version of the provider.
var version = "dev"
func main() {
debugFlag := flag.Bool("debug", false, "Start provider in debug mode.")
flag.Parse()
ctx := context.Background()
muxServer, err := server.NewMuxServer(ctx, version)
if err != nil {
log.Panic(err)
}
var serveOpts []tf6server.ServeOpt
if *debugFlag {
serveOpts = append(serveOpts, tf6server.WithManagedDebug())
}
name := registryPrefix + "aiven/aiven"
//goland:noinspection GoBoolExpressions
if version == "dev" {
name = registryPrefix + "aiven-dev/aiven"
}
err = tf6server.Serve(
name,
func() tfprotov6.ProviderServer {
return muxServer
},
serveOpts...,
)
if err != nil {
log.Panic(err)
}
}