|
@ -16,6 +16,7 @@ import ( |
|
|
"github.com/aws/aws-sdk-go/aws/credentials/stscreds" |
|
|
"github.com/aws/aws-sdk-go/aws/credentials/stscreds" |
|
|
"github.com/aws/aws-sdk-go/aws/session" |
|
|
"github.com/aws/aws-sdk-go/aws/session" |
|
|
"github.com/aws/aws-sdk-go/service/sts" |
|
|
"github.com/aws/aws-sdk-go/service/sts" |
|
|
|
|
|
"github.com/joho/godotenv" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
type ( |
|
|
type ( |
|
@ -32,6 +33,7 @@ type ( |
|
|
Parallelism int |
|
|
Parallelism int |
|
|
Targets []string |
|
|
Targets []string |
|
|
VarFiles []string |
|
|
VarFiles []string |
|
|
|
|
|
DeployEnvPath string |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Netrc is credentials for cloning
|
|
|
// Netrc is credentials for cloning
|
|
@ -81,6 +83,7 @@ func (p Plugin) Exec() error { |
|
|
|
|
|
|
|
|
commands = append(commands, exec.Command("terraform", "version")) |
|
|
commands = append(commands, exec.Command("terraform", "version")) |
|
|
|
|
|
|
|
|
|
|
|
p.CopyDeployEnv() |
|
|
CopyTfEnv() |
|
|
CopyTfEnv() |
|
|
|
|
|
|
|
|
if p.Config.Cacert != "" { |
|
|
if p.Config.Cacert != "" { |
|
@ -139,6 +142,18 @@ func (p Plugin) Exec() error { |
|
|
return nil |
|
|
return nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// CopyDeployEnv export env var from DeployEnvPath file
|
|
|
|
|
|
func (p Plugin) CopyDeployEnv() { |
|
|
|
|
|
envMap, err := godotenv.Read(p.Config.DeployEnvPath) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for k, v := range envMap { |
|
|
|
|
|
os.Setenv(k, v) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// CopyTfEnv creates copies of TF_VAR_ to lowercase
|
|
|
// CopyTfEnv creates copies of TF_VAR_ to lowercase
|
|
|
func CopyTfEnv() { |
|
|
func CopyTfEnv() { |
|
|
tfVar := regexp.MustCompile(`^TF_VAR_.*$`) |
|
|
tfVar := regexp.MustCompile(`^TF_VAR_.*$`) |
|
|