From 255e9cbc662a362db0ab62d8c8a84e101bbdb491 Mon Sep 17 00:00:00 2001 From: Michael Tibben Date: Mon, 20 Apr 2020 14:54:58 +1000 Subject: [PATCH] Don't set region env vars twice --- cli/exec.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cli/exec.go b/cli/exec.go index fadeb7758..cf97b43cc 100644 --- a/cli/exec.go +++ b/cli/exec.go @@ -188,9 +188,11 @@ func updateEnvForAwsVault(env environ, profileName string, region string) enviro env.Set("AWS_VAULT", profileName) - log.Printf("Setting subprocess env: AWS_DEFAULT_REGION=%s, AWS_REGION=%s", region, region) - env.Set("AWS_DEFAULT_REGION", region) - env.Set("AWS_REGION", region) + if region != "" { + log.Printf("Setting subprocess env: AWS_DEFAULT_REGION=%s, AWS_REGION=%s", region, region) + env.Set("AWS_DEFAULT_REGION", region) + env.Set("AWS_REGION", region) + } return env } @@ -259,10 +261,6 @@ func execEnvironment(input ExecCommandInput, config *vault.Config, creds *creden env := environ(os.Environ()) env = updateEnvForAwsVault(env, input.ProfileName, config.Region) - log.Printf("Setting subprocess env: AWS_DEFAULT_REGION=%s, AWS_REGION=%s", config.Region, config.Region) - env.Set("AWS_DEFAULT_REGION", config.Region) - env.Set("AWS_REGION", config.Region) - log.Println("Setting subprocess env: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY") env.Set("AWS_ACCESS_KEY_ID", val.AccessKeyID) env.Set("AWS_SECRET_ACCESS_KEY", val.SecretAccessKey)