From 4eeda67c135c59849f1b2db807b96b49b3c60a46 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 751118cb..21a8d458 100644 --- a/command/get.go +++ b/command/get.go @@ -8,7 +8,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/spf13/cobra" @@ -182,12 +181,7 @@ func (g GetCommand) fetchNewCredentials(ctx context.Context, account Account, cf 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),