Merge pull request #1470 from hashicorp/b-aws-fix-credential-detection

provider/aws: Detect creds in AWS config
This commit is contained in:
Clint 2015-04-10 10:06:08 -05:00
commit 7c676f8c91
1 changed files with 7 additions and 3 deletions

View File

@ -58,7 +58,7 @@ func (c *Config) Client() (interface{}, error) {
client.region = c.Region client.region = c.Region
log.Println("[INFO] Building AWS auth structure") log.Println("[INFO] Building AWS auth structure")
creds := aws.Creds(c.AccessKey, c.SecretKey, c.Token) creds := aws.DetectCreds(c.AccessKey, c.SecretKey, c.Token)
log.Println("[INFO] Initializing ELB connection") log.Println("[INFO] Initializing ELB connection")
client.elbconn = elb.New(creds, c.Region, nil) client.elbconn = elb.New(creds, c.Region, nil)
@ -76,9 +76,13 @@ func (c *Config) Client() (interface{}, error) {
client.r53conn = route53.New(creds, "us-east-1", nil) client.r53conn = route53.New(creds, "us-east-1", nil)
log.Println("[INFO] Initializing EC2 Connection") log.Println("[INFO] Initializing EC2 Connection")
client.ec2conn = ec2.New(creds, c.Region, nil) client.ec2conn = ec2.New(creds, c.Region, nil)
client.iamconn = iam.New(creds, c.Region, nil) client.iamconn = iam.New(creds, c.Region, nil)
client.ec2SDKconn = awsEC2.New(&awsSDK.Config{Region: c.Region})
sdkCreds := awsSDK.DetectCreds(c.AccessKey, c.SecretKey, c.Token)
client.ec2SDKconn = awsEC2.New(&awsSDK.Config{
Credentials: sdkCreds,
Region: c.Region,
})
} }
if len(errs) > 0 { if len(errs) > 0 {