Skip to content

Commit 3cd5db8

Browse files
committed
Adding support for network proxies in aws assume role configuration section
Signed-off-by: riquemon <[email protected]>
1 parent bf1cdcf commit 3cd5db8

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

lib/fluent/plugin/out_s3.rb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ def initialize
5353
config_param :policy, :string, default: nil
5454
desc "The duration, in seconds, of the role session (900-43200)"
5555
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
5660
end
5761
config_section :instance_profile_credentials, multi: false do
5862
desc "Number of times to retry when retrieving credentials"
@@ -470,8 +474,19 @@ def setup_credentials
470474
credentials_options[:policy] = c.policy if c.policy
471475
credentials_options[:duration_seconds] = c.duration_seconds if c.duration_seconds
472476
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)
475490
end
476491
options[:credentials] = Aws::AssumeRoleCredentials.new(credentials_options)
477492
when @web_identity_credentials

0 commit comments

Comments
 (0)