From 8a98c744ba683861238a7d2ff3aca6fcf41c8917 Mon Sep 17 00:00:00 2001 From: christophrj <137199105+christophrj@users.noreply.github.com> Date: Fri, 22 Nov 2024 14:26:41 +0100 Subject: [PATCH] fix(sdk-config): drop web identity usage from v1 default config Signed-off-by: christophrj <137199105+christophrj@users.noreply.github.com> --- pkg/utils/connect/aws/config.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/pkg/utils/connect/aws/config.go b/pkg/utils/connect/aws/config.go index 4106f66414..0ce76212a1 100644 --- a/pkg/utils/connect/aws/config.go +++ b/pkg/utils/connect/aws/config.go @@ -32,7 +32,7 @@ import ( stscredstypesv2 "github.com/aws/aws-sdk-go-v2/service/sts/types" awsv1 "github.com/aws/aws-sdk-go/aws" credentialsv1 "github.com/aws/aws-sdk-go/aws/credentials" - stscredsv1 "github.com/aws/aws-sdk-go/aws/credentials/stscreds" + defaultsv1 "github.com/aws/aws-sdk-go/aws/defaults" endpointsv1 "github.com/aws/aws-sdk-go/aws/endpoints" requestv1 "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/aws/session" @@ -672,17 +672,8 @@ func GetDefaultConfigV1() (*awsv1.Config, error) { muV1.Lock() defer muV1.Unlock() if defaultConfigV1 == nil { - cfg := awsv1.NewConfig() - sess, err := GetSessionV1(cfg) - if err != nil { - return nil, errors.Wrap(err, "failed to load default AWS config") - } - envCfg, err := config.NewEnvConfig() - if err != nil { - return nil, errors.Wrap(err, "failed to load default AWS env config") - } - creds := stscredsv1.NewWebIdentityCredentials(sess, envCfg.RoleARN, envCfg.RoleSessionName, envCfg.WebIdentityTokenFilePath) //nolint:staticcheck - defaultConfigV1 = cfg.WithCredentials(creds) + // use the sdk's default config + defaultConfigV1 = defaultsv1.Get().Config } return defaultConfigV1.Copy(), nil }