@@ -53,6 +53,10 @@ def initialize
53
53
config_param :policy , :string , default : nil
54
54
desc "The duration, in seconds, of the role session (900-43200)"
55
55
config_param :duration_seconds , :integer , default : nil
56
+ desc "A http proxy url for requests to aws sts service"
57
+ config_param :sts_http_proxy , :string , default : nil , secret : true
58
+ desc "A url for a regional sts api endpoint, the default is global"
59
+ config_param :sts_endpoint_url , :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"
@@ -470,8 +474,19 @@ def setup_credentials
470
474
credentials_options [ :policy ] = c . policy if c . policy
471
475
credentials_options [ :duration_seconds ] = c . duration_seconds if c . duration_seconds
472
476
credentials_options [ :external_id ] = c . external_id if c . external_id
473
- if @s3_region
474
- credentials_options [ :client ] = Aws ::STS ::Client . new ( region : @s3_region )
477
+ credentials_options [ :sts_endpoint_url ] = c . sts_endpoint_url if c . sts_endpoint_url
478
+ if c . sts_http_proxy and c . sts_endpoint_url
479
+ credentials_options [ :client ] = Aws ::STS ::Client . new ( http_proxy : c . sts_http_proxy , endpoint : c . sts_endpoint_url )
480
+ elsif @region and c . sts_http_proxy
481
+ credentials_options [ :client ] = Aws ::STS ::Client . new ( region : @region , http_proxy : c . sts_http_proxy )
482
+ elsif @region and c . sts_endpoint_url
483
+ credentials_options [ :client ] = Aws ::STS ::Client . new ( region : @region , endpoint : c . sts_endpoint_url )
484
+ elsif c . sts_http_proxy
485
+ credentials_options [ :client ] = Aws ::STS ::Client . new ( http_proxy : c . sts_http_proxy )
486
+ elsif c . sts_endpoint_url
487
+ credentials_options [ :client ] = Aws ::STS ::Client . new ( endpoint : c . sts_endpoint_url )
488
+ elsif @region
489
+ credentials_options [ :client ] = Aws ::STS ::Client . new ( region : @region )
475
490
end
476
491
options [ :credentials ] = Aws ::AssumeRoleCredentials . new ( credentials_options )
477
492
when @web_identity_credentials
0 commit comments