11//
2- // Copyright 2023 The Chainloop Authors.
2+ // Copyright 2023-2025 The Chainloop Authors.
33//
44// Licensed under the Apache License, Version 2.0 (the "License");
55// you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@ import (
2424 "strings"
2525
2626 "github.com/aws/aws-sdk-go-v2/aws"
27- "github.com/aws/aws-sdk-go-v2/config"
2827 awscreds "github.com/aws/aws-sdk-go-v2/credentials"
2928 "github.com/aws/aws-sdk-go-v2/service/secretsmanager"
3029 "github.com/aws/aws-sdk-go-v2/service/sso/types"
@@ -67,15 +66,11 @@ func NewManager(opts *NewManagerOpts) (*Manager, error) {
6766 logger := servicelogger .ScopedHelper (l , "credentials/aws-secrets-manager" )
6867 logger .Infow ("msg" , "configuring secrets-manager" , "region" , opts .Region , "role" , opts .Role , "prefix" , opts .SecretPrefix )
6968
70- config , err := config .LoadDefaultConfig (
71- context .TODO (),
72- config .WithRegion (opts .Region ),
73- config .WithCredentialsProvider (
74- awscreds .NewStaticCredentialsProvider (opts .AccessKey , opts .SecretKey , "" ),
75- ),
76- )
77- if err != nil {
78- return nil , fmt .Errorf ("loading AWS config: %w" , err )
69+ // Using AWS config directly instead of using config.LoadDefaultConfig
70+ // to avoid the default credential chain and use only the static credentials
71+ config := aws.Config {
72+ Region : opts .Region ,
73+ Credentials : awscreds .NewStaticCredentialsProvider (opts .AccessKey , opts .SecretKey , "" ),
7974 }
8075
8176 return & Manager {
0 commit comments