s3: prevent repeated credential queries with anonymous authentication

This commit is contained in:
Michael Eischer 2024-07-07 11:31:04 +02:00
parent be98402ac6
commit a2a2401a68

View file

@ -132,6 +132,9 @@ func getCredentials(cfg Config) (*credentials.Credentials, error) {
if c.SignerType == credentials.SignatureAnonymous {
debug.Log("using anonymous access for %#v", cfg.Endpoint)
// short circuit credentials resolution when using anonymous access
// otherwise the IAM provider would continuously try to (unsuccessfully) retrieve new credentials
creds = credentials.New(&credentials.Static{})
}
roleArn := os.Getenv("RESTIC_AWS_ASSUME_ROLE_ARN")