forked from codefresh-io/terraform-provider-codefresh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
33 lines (31 loc) · 803 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
package main
import (
"context"
"github.com/codefresh-io/terraform-provider-codefresh/codefresh"
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
"log"
"os"
//"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)
func main() {
debugMode := (os.Getenv("CODEFRESH_PLUGIN_DEBUG") != "")
// for terraform 0.13: export CODEFRESH_PLUGIN_ADDR="codefresh.io/app/codefresh"
providerAddr := os.Getenv("CODEFRESH_PLUGIN_ADDR")
if providerAddr == "" {
providerAddr = "registry.terraform.io/-/codefresh"
}
if debugMode {
err := plugin.Debug(context.Background(), providerAddr,
&plugin.ServeOpts{
ProviderFunc: codefresh.Provider,
})
if err != nil {
log.Println(err.Error())
}
} else {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: codefresh.Provider,
},
)
}
}