Support secrets manager JSON secrets #342
Labels
8.10-candidate
aws-λ-extension
AWS Lambda Extension
community
Issues and PRs created by the community
enhancement
New feature or request
triage
Issues and PRs that need to be triaged
Is your feature request related to a problem? Please describe.
Common way to store secrets in AWS secrets manager is in a JSON format.
However, current implementation supports only plain string value when processing ELASTIC_APM_SECRETS_MANAGER_SECRET_TOKEN_ID environment variable:
https://github.com/elastic/apm-aws-lambda/blob/main/app/aws.go#L70
It may be useful to support json secrets as well.
Describe the solution you'd like
We may consider to introduce second level environment variables, like
ELASTIC_APM_SECRETS_MANAGER_SECRET_TOKEN_JSON_FIELD
ELASTIC_APM_SECRETS_MANAGER_API_KEY_JSON_FIELD
If these env variables are set, prior to using secret value, we may attempt to parse string secret value into unstructured JSON map and retrieve token/apikey from map based on provided json field, before this lines:
https://github.com/elastic/apm-aws-lambda/blob/main/app/aws.go#L41
https://github.com/elastic/apm-aws-lambda/blob/main/app/aws.go#L52
Describe alternatives you've considered
Additional context
Existing doc: https://www.elastic.co/guide/en/apm/lambda/current/aws-lambda-secrets-manager.html
The text was updated successfully, but these errors were encountered: