Skip to content

Commit eb26edc

Browse files
authored
Merge pull request #308 from riquemon/master
Adding support for network proxies in aws assume role config s…
2 parents b3210b7 + 051ce99 commit eb26edc

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lib/fluent/plugin/out_s3.rb

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ def initialize
4141
config_param :external_id, :string, default: nil, secret: true
4242
desc "The region of the STS endpoint to use."
4343
config_param :sts_region, :string, default: nil
44+
desc "A http proxy url for requests to aws sts service"
45+
config_param :sts_http_proxy, :string, default: nil, secret: true
46+
desc "A url for a regional sts api endpoint, the default is global"
47+
config_param :sts_endpoint_url, :string, default: nil
4448
end
4549
# See the following link for additional params that could be added:
4650
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/STS/Client.html#assume_role_with_web_identity-instance_method
@@ -489,7 +493,19 @@ def setup_credentials
489493
credentials_options[:policy] = c.policy if c.policy
490494
credentials_options[:duration_seconds] = c.duration_seconds if c.duration_seconds
491495
credentials_options[:external_id] = c.external_id if c.external_id
492-
if c.sts_region
496+
credentials_options[:sts_endpoint_url] = c.sts_endpoint_url if c.sts_endpoint_url
497+
credentials_options[:sts_http_proxy] = c.sts_http_proxy if c.sts_http_proxy
498+
if c.sts_http_proxy && c.sts_endpoint_url
499+
credentials_options[:client] = Aws::STS::Client.new(http_proxy: c.sts_http_proxy, endpoint: c.sts_endpoint_url)
500+
elsif @region && c.sts_http_proxy
501+
credentials_options[:client] = Aws::STS::Client.new(region: @region, http_proxy: c.sts_http_proxy)
502+
elsif @region && c.sts_endpoint_url
503+
credentials_options[:client] = Aws::STS::Client.new(region: @region, endpoint: c.sts_endpoint_url)
504+
elsif c.sts_http_proxy
505+
credentials_options[:client] = Aws::STS::Client.new(http_proxy: c.sts_http_proxy)
506+
elsif c.sts_endpoint_url
507+
credentials_options[:client] = Aws::STS::Client.new(endpoint: c.sts_endpoint_url)
508+
elsif c.sts_region
493509
credentials_options[:client] = Aws::STS::Client.new(region: c.sts_region)
494510
elsif @s3_region
495511
credentials_options[:client] = Aws::STS::Client.new(region: @s3_region)

0 commit comments

Comments
 (0)