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

Support passing a SecretsManager Secret or SSM SecureString parameter ARN for lambda-promtail secrets #12420

Open
blimmer opened this issue Apr 1, 2024 · 0 comments
Labels
lambda-promtail type/feature Something new we should do

Comments

@blimmer
Copy link

blimmer commented Apr 1, 2024

Is your feature request related to a problem? Please describe.

Currently, secret values are passed to the lambda-promtail lambda function as environment variables:

CloudFormation:

PASSWORD: !Ref Password
BEARER_TOKEN: !Ref BearerToken

Terraform:

PASSWORD = var.password
BEARER_TOKEN = var.bearer_token

Passing secrets as an environment variable is not very secure and makes it difficult to rotate the secret (https://blog.jannikwempe.com/how-to-securely-use-secrets-in-aws-lambda). And, in CloudFormation/AWS CDK, dealing with secrets at template synthesis time is a challenge because, unlike Terraform, you can't fetch a secret from SSM/Secrets Manager at plan/deploy time.

A better practice would be to fetch the secret at runtime from Systems Manager Parameter Store (a SecureString) or Secrets Manager. This would be beneficial because:

  • The secret would not be stored in plaintext in the environment variables of the Lambda
  • You could update the secret value and automatically get the new value in the Lambda function
  • You could avoid having secrets checked into your Terraform / CloudFormation templates.

Describe the solution you'd like

All secret values (right now, PASSWORD/BEARER_TOKEN) should accept an ARN of an SSM parameter or Secrets Manager. In the lambda logic, if an ARN is detected, it should use the AWS SDK to fetch the SSM parameter or Secrets Manager Secret at runtime.

Describe alternatives you've considered

Alternatively, you could create new parameters (e.g., PASSWORD_SECRET_ARN / PASSWORD_SECRET_PARAMETER_ARN) to make it more explicit. Then, the user would be expected to only set one of the parameters only.

Additional context

@JStickler JStickler added type/feature Something new we should do lambda-promtail labels Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lambda-promtail type/feature Something new we should do
Projects
None yet
Development

No branches or pull requests

2 participants