Browse Source

fixing build errors

pull/66/head
Steve Min 7 years ago
parent
commit
3329e8b656
  1. 2
      main.go
  2. 18
      plugin.go

2
main.go

@ -82,7 +82,7 @@ func main() {
Name: "plugin_dir",
Usage: "whether or not to set custom plugin directory path",
EnvVar: "PLUGIN_DIR",
}
},
cli.BoolFlag{
Name: "sensitive",
Usage: "whether or not to suppress terraform commands to stdout",

18
plugin.go

@ -89,7 +89,7 @@ func (p Plugin) Exec() error {
}
commands = append(commands, deleteCache())
commands = append(commands, initCommand(p.Config.InitOptions))
commands = append(commands, initCommand(p.Config))
commands = append(commands, getModules())
// Add commands listed from Actions
@ -188,28 +188,28 @@ func getModules() *exec.Cmd {
)
}
func initCommand(config InitOptions) *exec.Cmd {
func initCommand(config Config) *exec.Cmd {
args := []string{
"init",
}
for _, v := range config.BackendConfig {
for _, v := range config.InitOptions.BackendConfig {
args = append(args, fmt.Sprintf("-backend-config=%s", v))
}
// True is default in TF
if config.Lock != nil {
args = append(args, fmt.Sprintf("-lock=%t", *config.Lock))
if config.InitOptions.Lock != nil {
args = append(args, fmt.Sprintf("-lock=%t", *config.InitOptions.Lock))
}
// "0s" is default in TF
if config.LockTimeout != "" {
args = append(args, fmt.Sprintf("-lock-timeout=%s", config.LockTimeout))
if config.InitOptions.LockTimeout != "" {
args = append(args, fmt.Sprintf("-lock-timeout=%s", config.InitOptions.LockTimeout))
}
if config.PluginDir == true {
if config.PluginPath != "" {
args = append(args, fmt.Sprintf("-plugin-dir=%s", config.PluginPath))
if config.InitOptions.PluginPath != "" {
args = append(args, fmt.Sprintf("-plugin-dir=%s", config.InitOptions.PluginPath))
}
}

Loading…
Cancel
Save