@@ -20,6 +20,7 @@ class AwsElasticsearchServiceOutput < ElasticsearchOutput
20
20
config_param :ecs_container_credentials_relative_uri , :string , :default => nil #Set with AWS_CONTAINER_CREDENTIALS_RELATIVE_URI environment variable value
21
21
config_param :assume_role_session_name , :string , :default => "fluentd"
22
22
config_param :assume_role_web_identity_token_file , :string , :default => nil
23
+ config_param :sts_credentials_region , :string , :default => nil
23
24
end
24
25
25
26
# here overrides default value of reload_connections to false because
@@ -86,17 +87,18 @@ def credentials(opts)
86
87
} ) . credentials
87
88
end
88
89
else
90
+
89
91
if opts [ :assume_role_web_identity_token_file ] . nil?
90
92
credentials = sts_credential_provider ( {
91
93
role_arn : opts [ :assume_role_arn ] ,
92
94
role_session_name : opts [ :assume_role_session_name ] ,
93
- region : opts [ :region ]
95
+ region : sts_credentials_region ( opts )
94
96
} ) . credentials
95
97
else
96
98
credentials = sts_web_identity_credential_provider ( {
97
99
role_arn : opts [ :assume_role_arn ] ,
98
100
web_identity_token_file : opts [ :assume_role_web_identity_token_file ] ,
99
- region : opts [ :region ]
101
+ region : sts_credentials_region ( opts )
100
102
} ) . credentials
101
103
end
102
104
end
@@ -111,6 +113,10 @@ def calback.inspect
111
113
calback
112
114
end
113
115
116
+ def sts_credentials_region ( opts )
117
+ opts [ :sts_credentials_region ] || opts [ :region ]
118
+ end
119
+
114
120
def sts_credential_provider ( opts )
115
121
# AssumeRoleCredentials is an auto-refreshing credential provider
116
122
@sts ||= Aws ::AssumeRoleCredentials . new ( opts )
0 commit comments