mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
Only use STS regional endpoint if a region is specified
This commit is contained in:
parent
dad90af22d
commit
1eccc9627c
2 changed files with 12 additions and 1 deletions
|
@ -44,7 +44,7 @@ module Fog
|
||||||
}
|
}
|
||||||
|
|
||||||
sts_endpoint =
|
sts_endpoint =
|
||||||
if ENV["AWS_STS_REGIONAL_ENDPOINTS"] == "regional"
|
if ENV["AWS_STS_REGIONAL_ENDPOINTS"] == "regional" && region
|
||||||
"https://sts.#{region}.amazonaws.com"
|
"https://sts.#{region}.amazonaws.com"
|
||||||
else
|
else
|
||||||
"https://sts.amazonaws.com"
|
"https://sts.amazonaws.com"
|
||||||
|
|
|
@ -103,6 +103,17 @@ Shindo.tests('AWS | credentials', ['aws']) do
|
||||||
|
|
||||||
ENV["AWS_STS_REGIONAL_ENDPOINTS"] = "regional"
|
ENV["AWS_STS_REGIONAL_ENDPOINTS"] = "regional"
|
||||||
|
|
||||||
|
tests('#fetch_credentials with no region specified') do
|
||||||
|
returns(
|
||||||
|
aws_access_key_id: 'dummykey',
|
||||||
|
aws_secret_access_key: 'dummysecret',
|
||||||
|
aws_session_token: 'dummytoken',
|
||||||
|
region: 'us-west-1',
|
||||||
|
sts_endpoint: "https://sts.amazonaws.com",
|
||||||
|
aws_credentials_expire_at: expires_at
|
||||||
|
) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true) }
|
||||||
|
end
|
||||||
|
|
||||||
tests('#fetch_credentials with regional STS endpoint') do
|
tests('#fetch_credentials with regional STS endpoint') do
|
||||||
returns(
|
returns(
|
||||||
aws_access_key_id: 'dummykey',
|
aws_access_key_id: 'dummykey',
|
||||||
|
|
Loading…
Reference in a new issue