From 1753b207824e628fb8435537e5f6408e45459033 Mon Sep 17 00:00:00 2001 From: Dan Pantry Date: Tue, 10 Dec 2024 12:30:58 -0800 Subject: [PATCH] Fix a bug where malformed ~/.aws/config would prevent loading credentials --- command/get.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/command/get.go b/command/get.go index 99f7373c..c46df796 100644 --- a/command/get.go +++ b/command/get.go @@ -7,7 +7,6 @@ import ( "time" "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/service/sts" "github.com/riotgames/key-conjurer/oauth2" "github.com/riotgames/key-conjurer/okta" @@ -129,12 +128,7 @@ func (g GetCommand) fetchNewCredentials(ctx context.Context, account Account, gl g.TimeToLive = cfg.TTL } - awsCfg, err := config.LoadDefaultConfig(ctx, config.WithRegion(g.Region)) - if err != nil { - return nil, err - } - - stsClient := sts.NewFromConfig(awsCfg) + stsClient := sts.New(sts.Options{Region: g.Region}) timeoutInSeconds := int32(3600 * g.TimeToLive) resp, err := stsClient.AssumeRoleWithSAML(ctx, &sts.AssumeRoleWithSAMLInput{ DurationSeconds: aws.Int32(timeoutInSeconds),