Skip to content

Commit

Permalink
fix static and check it was applied properly
Browse files Browse the repository at this point in the history
  • Loading branch information
julesjcraske committed Sep 18, 2024
1 parent eeb0e67 commit 2bcd02e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/config/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}

Expand All @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions lib/config/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2bcd02e

Please sign in to comment.