@@ -39,6 +39,8 @@ def initialize
39
39
config_param :duration_seconds , :integer , default : nil
40
40
desc "A unique identifier that is used by third parties when assuming roles in their customers' accounts."
41
41
config_param :external_id , :string , default : nil , secret : true
42
+ desc "The region of the STS endpoint to use."
43
+ config_param :sts_region , :string , default : nil
42
44
end
43
45
# See the following link for additional params that could be added:
44
46
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/STS/Client.html#assume_role_with_web_identity-instance_method
@@ -53,6 +55,8 @@ def initialize
53
55
config_param :policy , :string , default : nil
54
56
desc "The duration, in seconds, of the role session (900-43200)"
55
57
config_param :duration_seconds , :integer , default : nil
58
+ desc "The region of the STS endpoint to use."
59
+ config_param :sts_region , :string , default : nil
56
60
end
57
61
config_section :instance_profile_credentials , multi : false do
58
62
desc "Number of times to retry when retrieving credentials"
@@ -485,7 +489,9 @@ def setup_credentials
485
489
credentials_options [ :policy ] = c . policy if c . policy
486
490
credentials_options [ :duration_seconds ] = c . duration_seconds if c . duration_seconds
487
491
credentials_options [ :external_id ] = c . external_id if c . external_id
488
- if @s3_region
492
+ if c . sts_region
493
+ credentials_options [ :client ] = Aws ::STS ::Client . new ( region : c . sts_region )
494
+ elsif @s3_region
489
495
credentials_options [ :client ] = Aws ::STS ::Client . new ( region : @s3_region )
490
496
end
491
497
options [ :credentials ] = Aws ::AssumeRoleCredentials . new ( credentials_options )
@@ -496,7 +502,9 @@ def setup_credentials
496
502
credentials_options [ :web_identity_token_file ] = c . web_identity_token_file
497
503
credentials_options [ :policy ] = c . policy if c . policy
498
504
credentials_options [ :duration_seconds ] = c . duration_seconds if c . duration_seconds
499
- if @s3_region
505
+ if c . sts_region
506
+ credentials_options [ :client ] = Aws ::STS ::Client . new ( :region => c . sts_region )
507
+ elsif @s3_region
500
508
credentials_options [ :client ] = Aws ::STS ::Client . new ( :region => @s3_region )
501
509
end
502
510
options [ :credentials ] = Aws ::AssumeRoleWebIdentityCredentials . new ( credentials_options )
0 commit comments