Use RemoteCredProvider instead of EC2RoleProvider (#2983)

This commit is contained in:
Jeff Mitchell
2017-07-31 18:27:16 -04:00
committed by GitHub
parent 95ce578842
commit 54e3d61d6b
9 changed files with 74 additions and 47 deletions

View File

@@ -2,6 +2,7 @@ package aws
import (
"fmt"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
@@ -31,7 +32,13 @@ func getRootConfig(s logical.Storage) (*aws.Config, error) {
}
if credsConfig.Region == "" {
credsConfig.Region = "us-east-1"
credsConfig.Region = os.Getenv("AWS_REGION")
if credsConfig.Region == "" {
credsConfig.Region = os.Getenv("AWS_DEFAULT_REGION")
if credsConfig.Region == "" {
credsConfig.Region = "us-east-1"
}
}
}
credsConfig.HTTPClient = cleanhttp.DefaultClient()