providers/aws: chain credentials

This commit is contained in:
Mitchell Hashimoto 2015-05-05 10:44:19 -07:00
parent 094c859f2c
commit 7a5499d4f7
1 changed files with 10 additions and 1 deletions

View File

@ -62,7 +62,16 @@ func (c *Config) Client() (interface{}, error) {
client.region = c.Region
log.Println("[INFO] Building AWS auth structure")
creds := credentials.NewStaticCredentials(c.AccessKey, c.SecretKey, c.Token)
creds := credentials.NewChainCredentials([]credentials.Provider{
&credentials.StaticProvider{Value: credentials.Value{
AccessKeyID: c.AccessKey,
SecretAccessKey: c.SecretKey,
SessionToken: c.Token,
}},
&credentials.EnvProvider{},
&credentials.SharedCredentialsProvider{Filename: "", Profile: ""},
&credentials.EC2RoleProvider{},
})
awsConfig := &aws.Config{
Credentials: creds,
Region: c.Region,