From eb4b48bb8d3134bfeafcb6ae22efeab39038364c Mon Sep 17 00:00:00 2001 From: holtwilkins Date: Mon, 20 Nov 2017 16:00:49 -0800 Subject: [PATCH] Use correct env var (#7) As per https://docs.aws.amazon.com/cli/latest/userguide/cli-environment.html Fixes https://github.com/palantir/bouncer/issues/6 --- aws/asg.go | 2 +- aws/aws.go | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/aws/asg.go b/aws/asg.go index 55e2363e..a4060360 100644 --- a/aws/asg.go +++ b/aws/asg.go @@ -73,7 +73,7 @@ func (c *Clients) GetASG(asgName *string) (*autoscaling.Group, error) { } if len(asgs) != 1 { - return nil, errors.Errorf("ASG Name '%s' matched '%v' ASGs, expecting it to match 1 (looking in region %s, have you set AWS_REGION?)", *asgName, len(asgs), c.ASGClient.SigningRegion) + return nil, errors.Errorf("ASG Name '%s' matched '%v' ASGs, expecting it to match 1 (looking in region %s, have you set AWS_DEFAULT_REGION?)", *asgName, len(asgs), c.ASGClient.SigningRegion) } return asgs[0], nil diff --git a/aws/aws.go b/aws/aws.go index 996a1d05..159125ce 100644 --- a/aws/aws.go +++ b/aws/aws.go @@ -47,12 +47,9 @@ func GetAWSClients() (*Clients, error) { return nil, errors.Errorf("Your AWS Credentials are expired") } - region := os.Getenv("AWS_REGION") + region := os.Getenv("AWS_DEFAULT_REGION") if region == "" { - region = os.Getenv("AWS_DEFAULT_REGION") - if region == "" { - region = "us-east-1" - } + region = "us-east-1" } awsConf := aws.Config{