diff --git a/plugin.go b/plugin.go index ff9f47c..afafd5a 100644 --- a/plugin.go +++ b/plugin.go @@ -210,6 +210,12 @@ func planCommand(config Config) *exec.Cmd { if config.Parallelism > 0 { args = append(args, fmt.Sprintf("-parallelism=%d", config.Parallelism)) } + if config.InitOptions.Lock != nil { + args = append(args, fmt.Sprintf("-lock=%t", *config.InitOptions.Lock)) + } + if config.InitOptions.LockTimeout != "" { + args = append(args, fmt.Sprintf("-lock-timeout=%s", config.InitOptions.LockTimeout)) + } return exec.Command( "terraform", args..., @@ -234,6 +240,12 @@ func applyCommand(config Config) *exec.Cmd { if config.Parallelism > 0 { args = append(args, fmt.Sprintf("-parallelism=%d", config.Parallelism)) } + if config.InitOptions.Lock != nil { + args = append(args, fmt.Sprintf("-lock=%t", *config.InitOptions.Lock)) + } + if config.InitOptions.LockTimeout != "" { + args = append(args, fmt.Sprintf("-lock-timeout=%s", config.InitOptions.LockTimeout)) + } args = append(args, "plan.tfout") return exec.Command( "terraform", @@ -251,6 +263,12 @@ func destroyCommand(config Config) *exec.Cmd { if config.Parallelism > 0 { args = append(args, fmt.Sprintf("-parallelism=%d", config.Parallelism)) } + if config.InitOptions.Lock != nil { + args = append(args, fmt.Sprintf("-lock=%t", *config.InitOptions.Lock)) + } + if config.InitOptions.LockTimeout != "" { + args = append(args, fmt.Sprintf("-lock-timeout=%s", config.InitOptions.LockTimeout)) + } args = append(args, "-force") return exec.Command( "terraform",