Merge pull request #4168 from mitchellh/noerrorsess
fix new session error when creating cred chain.
This commit is contained in:
commit
900db6be84
|
@ -45,10 +45,6 @@ func (c *AccessConfig) Config() (*aws.Config, error) {
|
|||
return nil, err
|
||||
}
|
||||
} else {
|
||||
session, err := session.NewSession(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
creds = credentials.NewChainCredentials([]credentials.Provider{
|
||||
&credentials.StaticProvider{Value: credentials.Value{
|
||||
AccessKeyID: c.AccessKey,
|
||||
|
@ -58,7 +54,7 @@ func (c *AccessConfig) Config() (*aws.Config, error) {
|
|||
&credentials.EnvProvider{},
|
||||
&credentials.SharedCredentialsProvider{Filename: "", Profile: ""},
|
||||
&ec2rolecreds.EC2RoleProvider{
|
||||
Client: ec2metadata.New(session),
|
||||
Client: ec2metadata.New(session.New(config)),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue