From 2c98f5f5208c421e35976c4cbdbf4a7c032a4d0e Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 17 Oct 2016 15:25:00 -0400 Subject: [PATCH] Add 'terraform validate' command. --- main.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 951494b..69c9869 100644 --- a/main.go +++ b/main.go @@ -2,16 +2,17 @@ package main import ( "fmt" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/credentials/stscreds" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/sts" - "github.com/drone/drone-plugin-go/plugin" "io/ioutil" "os" "os/exec" "strings" "time" + + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/credentials/stscreds" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/sts" + "github.com/drone/drone-plugin-go/plugin" ) var ( @@ -58,6 +59,7 @@ func main() { commands = append(commands, remoteConfigCommand(remote)) } commands = append(commands, getModules()) + commands = append(commands, validateCommand()) commands = append(commands, planCommand(vargs.Vars, vargs.Parallelism)) if !vargs.Plan { commands = append(commands, applyCommand(vargs.Parallelism)) @@ -130,6 +132,16 @@ func getModules() *exec.Cmd { ) } +func validateCommand() *exec.Cmd { + args := []string{ + "validate", + } + return exec.Command( + "terraform", + args..., + ) +} + func planCommand(variables map[string]string, parallelism int) *exec.Cmd { args := []string{ "plan",