forked from TrueCloudLab/distribution
Merge pull request #2002 from lnr0626/1996-instance-roles-with-regionendpoint
Allow using ec2 roles when specifying region endpoint
This commit is contained in:
commit
d0cdc4802b
1 changed files with 12 additions and 22 deletions
|
@ -389,29 +389,19 @@ func New(params DriverParameters) (*Driver, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
awsConfig := aws.NewConfig()
|
awsConfig := aws.NewConfig()
|
||||||
var creds *credentials.Credentials
|
creds := credentials.NewChainCredentials([]credentials.Provider{
|
||||||
if params.RegionEndpoint == "" {
|
&credentials.StaticProvider{
|
||||||
creds = credentials.NewChainCredentials([]credentials.Provider{
|
Value: credentials.Value{
|
||||||
&credentials.StaticProvider{
|
AccessKeyID: params.AccessKey,
|
||||||
Value: credentials.Value{
|
SecretAccessKey: params.SecretKey,
|
||||||
AccessKeyID: params.AccessKey,
|
|
||||||
SecretAccessKey: params.SecretKey,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
&credentials.EnvProvider{},
|
},
|
||||||
&credentials.SharedCredentialsProvider{},
|
&credentials.EnvProvider{},
|
||||||
&ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(session.New())},
|
&credentials.SharedCredentialsProvider{},
|
||||||
})
|
&ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(session.New())},
|
||||||
} else {
|
})
|
||||||
creds = credentials.NewChainCredentials([]credentials.Provider{
|
|
||||||
&credentials.StaticProvider{
|
if params.RegionEndpoint != "" {
|
||||||
Value: credentials.Value{
|
|
||||||
AccessKeyID: params.AccessKey,
|
|
||||||
SecretAccessKey: params.SecretKey,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
&credentials.EnvProvider{},
|
|
||||||
})
|
|
||||||
awsConfig.WithS3ForcePathStyle(true)
|
awsConfig.WithS3ForcePathStyle(true)
|
||||||
awsConfig.WithEndpoint(params.RegionEndpoint)
|
awsConfig.WithEndpoint(params.RegionEndpoint)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue