From 57bbf4f32412b4a22ebd6abf69cc837d3643371b Mon Sep 17 00:00:00 2001 From: Patrick Jones Date: Wed, 17 Mar 2021 15:44:40 -0700 Subject: [PATCH] AWS_DEFAULT_REGION should have been checked as a backup to AWS_REGION, but wasn't. Also removed a redundant print statement in a test case. Change-Id: I0de4bcd5a134f7a9af249e5ebe56dfc3d35abf6d --- google/internal/externalaccount/aws.go | 2 ++ google/internal/externalaccount/urlcredsource_test.go | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/google/internal/externalaccount/aws.go b/google/internal/externalaccount/aws.go index 2f078f7..554c8f8 100644 --- a/google/internal/externalaccount/aws.go +++ b/google/internal/externalaccount/aws.go @@ -341,6 +341,8 @@ func (cs awsCredentialSource) subjectToken() (string, error) { func (cs *awsCredentialSource) getRegion() (string, error) { if envAwsRegion := getenv("AWS_REGION"); envAwsRegion != "" { return envAwsRegion, nil + } else if envAwsRegion := getenv("AWS_DEFAULT_REGION"); envAwsRegion != "" { + return envAwsRegion, nil } if cs.RegionURL == "" { diff --git a/google/internal/externalaccount/urlcredsource_test.go b/google/internal/externalaccount/urlcredsource_test.go index 8ade2a2..6a36d0d 100644 --- a/google/internal/externalaccount/urlcredsource_test.go +++ b/google/internal/externalaccount/urlcredsource_test.go @@ -7,7 +7,6 @@ package externalaccount import ( "context" "encoding/json" - "fmt" "net/http" "net/http/httptest" "testing" @@ -20,7 +19,6 @@ func TestRetrieveURLSubjectToken_Text(t *testing.T) { if r.Method != "GET" { t.Errorf("Unexpected request method, %v is found", r.Method) } - fmt.Println(r.Header) if r.Header.Get("Metadata") != "True" { t.Errorf("Metadata header not properly included.") }