diff --git a/lib/config/aws.go b/lib/config/aws.go index 636a9af..89cbcbd 100644 --- a/lib/config/aws.go +++ b/lib/config/aws.go @@ -38,7 +38,7 @@ func (a AWS) Session() (*session.Session, error) { } func (a AWS) SessionV2(ctx context.Context) (aws2.Config, error) { - opts := []config.LoadOptionsFunc{ + opts := []func(*config.LoadOptions) error{ config.WithRegion(a.Region), } @@ -48,6 +48,7 @@ func (a AWS) SessionV2(ctx context.Context) (aws2.Config, error) { cfg, err := config.LoadDefaultConfig( ctx, + opts..., ) if err != nil { return aws2.Config{}, errors.Wrap(err, "aws v2 config") diff --git a/lib/config/aws_test.go b/lib/config/aws_test.go index 1f1a911..beb517f 100644 --- a/lib/config/aws_test.go +++ b/lib/config/aws_test.go @@ -45,6 +45,10 @@ func TestAWS_SessionV2_Static(t *testing.T) { cfg, err := a.SessionV2(context.Background()) require.NoError(t, err) + credentials, err := cfg.Credentials.Retrieve(context.Background()) + require.NoError(t, err) + require.Equal(t, "static", credentials.Source) + client2 := sts.NewFromConfig(cfg) _, err = client2.GetCallerIdentity(context.Background(), &sts.GetCallerIdentityInput{}) require.NoError(t, err)