Skip to content

Commit

Permalink
fix assume role (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik authored Jul 3, 2023
1 parent 388ca86 commit 69f2a08
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions flow/connectors/utils/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
Expand Down Expand Up @@ -73,21 +72,10 @@ func CreateS3Client() (*s3.S3, error) {
return nil, fmt.Errorf("failed to get AWS secrets: %w", err)
}

if awsSecrets.AwsRoleArn != "" {
sess := session.Must(session.NewSession(&aws.Config{
Region: aws.String(awsSecrets.Region),
}))
sess := session.Must(session.NewSession(&aws.Config{
Region: aws.String(awsSecrets.Region),
}))

creds := stscreds.NewCredentials(sess, awsSecrets.AwsRoleArn)

s3svc := s3.New(sess, &aws.Config{Credentials: creds})
return s3svc, nil
} else {
sess := session.Must(session.NewSession(&aws.Config{
Region: aws.String(awsSecrets.Region),
}))

s3svc := s3.New(sess)
return s3svc, nil
}
s3svc := s3.New(sess)
return s3svc, nil
}

0 comments on commit 69f2a08

Please sign in to comment.