-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathmain.go
More file actions
44 lines (35 loc) · 905 Bytes
/
main.go
File metadata and controls
44 lines (35 loc) · 905 Bytes
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
package main
import (
"context"
"flag"
"log"
"github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server"
"github.com/hashicorp/terraform-plugin-mux/tf6muxserver"
"github.com/scaleway/terraform-provider-scaleway/v2/provider"
)
func main() {
ctx := context.Background()
var debugMode bool
flag.BoolVar(&debugMode, "debuggable", false, "set to true to run the provider with support for debuggers like delve")
flag.Parse()
var serveOpts []tf6server.ServeOpt
if debugMode {
serveOpts = append(serveOpts, tf6server.WithManagedDebug())
}
providers, err := provider.NewProviderList(ctx, nil)
if err != nil {
log.Fatal(err)
}
muxServer, err := tf6muxserver.NewMuxServer(ctx, providers...)
if err != nil {
log.Fatal(err)
}
err = tf6server.Serve(
"registry.terraform.io/scaleway/scaleway",
muxServer.ProviderServer,
serveOpts...,
)
if err != nil {
log.Fatal(err)
}
}