Skip to content

Commit acd69f4

Browse files
authored
Update plugin.go
1 parent 0293910 commit acd69f4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

plugin.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ type Plugin struct {
2929
AssumeRoleSessionName string
3030
Bucket string
3131
UserRoleArn string
32-
UserRoleExternalID string
3332

3433
// if not "", enable server-side encryption
3534
// valid values are:
@@ -461,10 +460,19 @@ func (p *Plugin) createS3Client() *s3.S3 {
461460
log.Warn("AWS Key and/or Secret not provided (falling back to ec2 instance profile)")
462461
}
463462

463+
sess, err = session.NewSession(conf)
464+
if err != nil {
465+
log.Fatalf("failed to create AWS session: %v", err)
466+
}
467+
464468
client := s3.New(sess, conf)
465469

466470
if len(p.UserRoleArn) > 0 {
467-
// Create new credentials by assuming the UserRoleArn (with ExternalID when provided)
471+
log.WithFields(log.Fields{
472+
"UserRoleArn": p.UserRoleArn,
473+
}).Info("Assuming user role ARN")
474+
475+
// Create new credentials by assuming the UserRoleArn with ExternalID
468476
creds := stscreds.NewCredentials(sess, p.UserRoleArn, func(provider *stscreds.AssumeRoleProvider) {
469477
if p.UserRoleExternalID != "" {
470478
provider.ExternalID = aws.String(p.UserRoleExternalID)

0 commit comments

Comments
 (0)