Skip to content

Commit 21e7a90

Browse files
author
steven-l
committed
add token to support AWS temporary credentials
see https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html Signed-off-by: steven-l <[email protected]>
1 parent c5e1b60 commit 21e7a90

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

Diff for: sigv4/sigv4.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func NewSigV4RoundTripper(cfg *SigV4Config, next http.RoundTripper) (http.RoundT
5555
next = http.DefaultTransport
5656
}
5757

58-
creds := credentials.NewStaticCredentials(cfg.AccessKey, string(cfg.SecretKey), "")
58+
creds := credentials.NewStaticCredentials(cfg.AccessKey, string(cfg.SecretKey), cfg.Token)
5959
if cfg.AccessKey == "" && cfg.SecretKey == "" {
6060
creds = nil
6161
}

Diff for: sigv4/sigv4_config.go

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type SigV4Config struct {
2828
SecretKey config.Secret `yaml:"secret_key,omitempty"`
2929
Profile string `yaml:"profile,omitempty"`
3030
RoleARN string `yaml:"role_arn,omitempty"`
31+
Token string `yaml:"token,omitempty"`
3132
}
3233

3334
func (c *SigV4Config) Validate() error {

Diff for: sigv4/testdata/sigv4_good.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
region: us-east-2
22
access_key: AccessKey
33
secret_key: SecretKey
4+
token: token
45
profile: profile
56
role_arn: blah:role/arn

0 commit comments

Comments
 (0)