mirror of
https://github.com/thegeeklab/wp-opentofu.git
synced 2024-11-09 18:00:40 +00:00
Override environment variables only when changed
When using Command.Env, if you send nil as a value, it will use all of the environment variables from os.Environ() when executing the command. In order to not break the current tests and be coherent with the current relationship, we are appending the created environment variables with os.Environ() only when we have at least 1 environment variable to override.
This commit is contained in:
parent
eb0aab1bbc
commit
13a6625b51
@ -382,7 +382,10 @@ func createEnvironmentVariables(config Config) []string {
|
||||
|
||||
func createTerraformCommand(config Config, args ...string) *exec.Cmd {
|
||||
command := exec.Command("terraform", args...)
|
||||
command.Env = append(command.Env, createEnvironmentVariables(config)...)
|
||||
environmentVariables := createEnvironmentVariables(config)
|
||||
if len(environmentVariables) > 0 {
|
||||
command.Env = append(os.Environ(), environmentVariables...)
|
||||
}
|
||||
return command
|
||||
}
|
||||
func getTfoutPath(config Config) string {
|
||||
|
Loading…
Reference in New Issue
Block a user