Merge pull request #4168 from mitchellh/noerrorsess

fix new session error when creating cred chain.
This commit is contained in:
Matthew Hooker 2016-11-14 11:44:03 -08:00 committed by GitHub
commit 900db6be84
1 changed files with 1 additions and 5 deletions

View File

@ -45,10 +45,6 @@ func (c *AccessConfig) Config() (*aws.Config, error) {
return nil, err return nil, err
} }
} else { } else {
session, err := session.NewSession(config)
if err != nil {
return nil, err
}
creds = credentials.NewChainCredentials([]credentials.Provider{ creds = credentials.NewChainCredentials([]credentials.Provider{
&credentials.StaticProvider{Value: credentials.Value{ &credentials.StaticProvider{Value: credentials.Value{
AccessKeyID: c.AccessKey, AccessKeyID: c.AccessKey,
@ -58,7 +54,7 @@ func (c *AccessConfig) Config() (*aws.Config, error) {
&credentials.EnvProvider{}, &credentials.EnvProvider{},
&credentials.SharedCredentialsProvider{Filename: "", Profile: ""}, &credentials.SharedCredentialsProvider{Filename: "", Profile: ""},
&ec2rolecreds.EC2RoleProvider{ &ec2rolecreds.EC2RoleProvider{
Client: ec2metadata.New(session), Client: ec2metadata.New(session.New(config)),
}, },
}) })
} }