Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(aws-lambda): add configurable sts endpoint url for aws-lambda plugin #13388

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
"**AWS-Lambda**: Added support for a configurable STS endpoint with the new configuration field `aws_sts_endpoint_url`.
type: feature
scope: Plugin
13 changes: 13 additions & 0 deletions kong/clustering/compat/checkers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ local compatible_checkers = {
end
end

for _, plugin in ipairs(config_table.plugins or {}) do
if plugin.name == 'aws-lambda' then
local config = plugin.config
if config.aws_sts_endpoint_url ~= nil then
config.aws_sts_endpoint_url = nil
has_update = true
log_warn_message('configures ' .. plugin.name .. ' plugin with aws_sts_endpoint_url',
'will be removed.',
dp_version, log_suffix)
end
end
end

return has_update
end
},
Expand Down
2 changes: 2 additions & 0 deletions kong/plugins/aws-lambda/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ local build_cache_key do
-- vault refresh can take effect when key/secret is rotated
local SERVICE_RELATED_FIELD = { "timeout", "keepalive", "aws_key", "aws_secret",
"aws_assume_role_arn", "aws_role_session_name",
"aws_sts_endpoint_url",
"aws_region", "host", "port", "disable_https",
"proxy_url", "aws_imds_protocol_version" }

Expand Down Expand Up @@ -132,6 +133,7 @@ function AWSLambdaHandler:access(conf)
credentials = credentials,
region = region,
stsRegionalEndpoints = AWS_GLOBAL_CONFIG.sts_regional_endpoints,
endpoint = conf.aws_sts_endpoint_url,
ssl_verify = false,
http_proxy = conf.proxy_url,
https_proxy = conf.proxy_url,
Expand Down
1 change: 1 addition & 0 deletions kong/plugins/aws-lambda/schema.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ return {
{ aws_role_session_name = { description = "The identifier of the assumed role session.", type = "string",
default = "kong"
} },
{ aws_sts_endpoint_url = typedefs.url },
{ aws_region = typedefs.host },
{ function_name = {
type = "string",
Expand Down
Loading