|
@ -2,16 +2,17 @@ package main |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"fmt" |
|
|
"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" |
|
|
"io/ioutil" |
|
|
"os" |
|
|
"os" |
|
|
"os/exec" |
|
|
"os/exec" |
|
|
"strings" |
|
|
"strings" |
|
|
"time" |
|
|
"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 ( |
|
|
var ( |
|
@ -58,6 +59,7 @@ func main() { |
|
|
commands = append(commands, remoteConfigCommand(remote)) |
|
|
commands = append(commands, remoteConfigCommand(remote)) |
|
|
} |
|
|
} |
|
|
commands = append(commands, getModules()) |
|
|
commands = append(commands, getModules()) |
|
|
|
|
|
commands = append(commands, validateCommand()) |
|
|
commands = append(commands, planCommand(vargs.Vars, vargs.Parallelism)) |
|
|
commands = append(commands, planCommand(vargs.Vars, vargs.Parallelism)) |
|
|
if !vargs.Plan { |
|
|
if !vargs.Plan { |
|
|
commands = append(commands, applyCommand(vargs.Parallelism)) |
|
|
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 { |
|
|
func planCommand(variables map[string]string, parallelism int) *exec.Cmd { |
|
|
args := []string{ |
|
|
args := []string{ |
|
|
"plan", |
|
|
"plan", |
|
|