-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
58 lines (49 loc) · 1021 Bytes
/
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
55
56
57
58
package main
import (
"context"
"flag"
"log"
"os"
"github.com/hashicorp/terraform-plugin-framework/providerserver"
"github.com/timescale/terraform-provider-timescale/internal/provider"
)
//go:generate terraform fmt -recursive ./examples/
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
var (
Version = "dev"
debug bool
version bool
)
func init() {
flag.BoolVar(
&debug,
"debug",
false,
"set to true to run the provider with support for debuggers like delve",
)
flag.BoolVar(
&version,
"version",
false,
"display the provider version",
)
flag.Parse()
if version {
displayVersion()
os.Exit(0)
}
}
func displayVersion() {
log.Printf("Timescale provider v%s\n", Version)
}
func main() {
opts := providerserver.ServeOpts{
Address: "registry.terraform.io/timescale/timescale",
Debug: debug,
}
displayVersion()
err := providerserver.Serve(context.Background(), provider.New(Version), opts)
if err != nil {
log.Fatal(err.Error())
}
}