Skip to content

Commit

Permalink
Avoid panic in aws.GetCloudId
Browse files Browse the repository at this point in the history
  • Loading branch information
orlangure committed Dec 26, 2021
1 parent 2f2ab9a commit 7da7b60
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cloudprovider/aws/cloud_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ func GetCloudId() (string, error) {
// So, caller identity request can be only us-east-1. Default call brings region where caller is
region := "us-east-1"

svc := sts.New(session.Must(session.NewSession()), aws.NewConfig().WithRegion(region))
sess, err := session.NewSession()
if err != nil {
return "", err
}

svc := sts.New(sess, aws.NewConfig().WithRegion(region))
input := &sts.GetCallerIdentityInput{}
req, _ := svc.GetCallerIdentityRequest(input)

err := req.Sign()
if err != nil {
if err := req.Sign(); err != nil {
return "", err
}

Expand Down

0 comments on commit 7da7b60

Please sign in to comment.