|
260 | 260 | end
|
261 | 261 |
|
262 | 262 |
|
263 |
| -local isRegionalSTSDomain do |
| 263 | +local is_regional_sts_domain do |
264 | 264 | -- from the list described in https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html
|
265 | 265 | -- TODO: not sure if gov cloud also has their own endpoints so leave it for now
|
266 | 266 | local stsRegionRegexes = {
|
267 | 267 | [[sts\.(us|eu|ap|sa|ca|me)\-\w+\-\d+\.amazonaws\.com$]],
|
268 | 268 | [[sts\.cn\-\w+\-\d+\.amazonaws\.com\.cn$]],
|
269 | 269 | }
|
270 | 270 |
|
271 |
| - function isRegionalSTSDomain(domain) |
| 271 | + function is_regional_sts_domain(domain) |
272 | 272 | for _, entry in ipairs(stsRegionRegexes) do
|
273 | 273 | if ngx.re.match(domain, entry, "jo") then
|
274 | 274 | return true
|
@@ -352,7 +352,7 @@ local function generate_service_methods(service)
|
352 | 352 | -- If the endpoint is a VPC endpoint DNS hostname, or a regional STS domain, then we don't need to inject the region
|
353 | 353 | -- VPC endpoint DNS hostnames always contain region, see
|
354 | 354 | -- https://docs.aws.amazon.com/vpc/latest/privatelink/privatelink-access-aws-services.html#interface-endpoint-dns-hostnames
|
355 |
| - if not service.config.endpoint:match(AWS_VPC_ENDPOINT_DOMAIN_PATTERN) and not isRegionalSTSDomain(service.config.endpoint) then |
| 355 | + if not service.config.endpoint:match(AWS_VPC_ENDPOINT_DOMAIN_PATTERN) and not is_regional_sts_domain(service.config.endpoint) then |
356 | 356 | local pre, post = service.config.endpoint:match(AWS_PUBLIC_DOMAIN_PATTERN)
|
357 | 357 | service.config.endpoint = pre .. "." .. service.config.region .. post
|
358 | 358 | end
|
|
0 commit comments