Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
fix: Hardcoded region for Get-Caller-Identity call
Browse files Browse the repository at this point in the history
  • Loading branch information
bbernays authored May 17, 2022
1 parent 2a4c817 commit 0f2091e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,7 @@ func isAllRegions(regions []string) bool {

func getAccountId(ctx context.Context, awsCfg aws.Config) (*sts.GetCallerIdentityOutput, error) {
svc := sts.NewFromConfig(awsCfg)
return svc.GetCallerIdentity(ctx, &sts.GetCallerIdentityInput{}, func(o *sts.Options) {
o.Region = "aws-global"
})

return svc.GetCallerIdentity(ctx, &sts.GetCallerIdentityInput{})
}

type AssumeRoleAPIClient interface {
Expand Down Expand Up @@ -525,7 +522,7 @@ func Configure(logger hclog.Logger, providerConfig interface{}) (schema.ClientMe
if len(account.Regions) == 0 {
return nil, diags.Add(diag.FromError(fmt.Errorf("no enabled regions provided in config for account %s", account.AccountName), diag.USER))
}

awsCfg.Region = account.Regions[0]
output, err := getAccountId(ctx, awsCfg)
if err != nil {
return nil, diags.Add(classifyError(err, diag.INTERNAL, nil))
Expand Down

0 comments on commit 0f2091e

Please sign in to comment.