-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (35 loc) · 981 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
package main
import (
"os"
tgengine "github.com/gruntwork-io/terragrunt-engine-go/engine"
"github.com/gruntwork-io/terragrunt-engine-terraform/engine"
"github.com/sirupsen/logrus"
"github.com/hashicorp/go-plugin"
)
const (
engineLogLevelEnv = "TG_ENGINE_LOG_LEVEL"
defaultEngineLogLevel = "INFO"
)
func main() {
engineLogLevel := os.Getenv(engineLogLevelEnv)
if engineLogLevel == "" {
engineLogLevel = defaultEngineLogLevel
}
parsedLevel, err := logrus.ParseLevel(engineLogLevel)
if err != nil {
logrus.Warnf("Error parsing log level: %v", err)
parsedLevel = logrus.InfoLevel
}
logrus.SetLevel(parsedLevel)
plugin.Serve(&plugin.ServeConfig{
HandshakeConfig: plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "engine",
MagicCookieValue: "terragrunt",
},
Plugins: map[string]plugin.Plugin{
"terraform": &tgengine.TerragruntGRPCEngine{Impl: &engine.TerraformEngine{}},
},
GRPCServer: plugin.DefaultGRPCServer,
})
}