-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
feature: Resolve environment variables with values of the Secrets Manager #310
Comments
Hi. I suggest to use handlename/ssmwrap for the workaround. ssmwrap can look up values in the SSM parameter store and run a specified command with environment variables that are set by these values. $ ssmwrap --names /path/to/foo -- sh -c 'echo $FOO'
value of foo And SecretManager's secrets can be read via SSM parameter store with the prefix '/aws/reference/secretsmanager'. So, by these methods, you can run lambroll with environment variables from SecretsManager. $ ssmwrap --names /aws/reference/secretsmanager/mysecret -- lambroll ... function.json {
"Environment": {
"Variables": {
"MYSECRET": "{{ must_env `MYSECRET` }}"
}
},
// ...
} But, this solution is complex a little. I'm planning to introduce |
@miztch But, I don't recommend setting secrets into Lambda environment variables directly. Secrets are exposed as plain text if someone can read the lambda function configuration. If you try this method, please consider that risk. |
Thank you for your immediate reply! I will try the workaround you suggested. Also, I am already aware of the security risks you pointed out. Thanks for this one as well. |
Thank you for the other day. In my project, I found it difficult to retrieve the secret value using ssmwrap because the secret value was not just a value, but a key/value pair. So I solved this issue by implementing a little custom script. Therefore I am willing to let you close this issue. Since we are considering managing these secret values with SSM, there may be an opportunity to use the SSM plugin you implemented in #319. Thanks again for listening to my voice 🙏 |
Hi! https://github.com/fujiwara/lambroll?tab=readme-ov-file#expand-ssm-parameter-values |
Thanks! I'm now installing it for some functions! |
Hello, I would like to use some secret values stored in the Secrets Manager as environment variables for my existing Lambda functions.
I intend to use lambroll in new deploy pipeline(simply done with build source on S3 and lambroll runs on CodeBuild). Unless if we do not use AWS Parameters and Secrets Lambda Extension, Terraform state, or anything else, we need to implement the logic to retrieve the secret value by scratch.
For example, in CloudFormation, it can be resolved to the secret value with the following format.
{{resolve:secretsmanager:secret-id:SecretString:json-key:version-stage:version-id}}
https://docs.aws.amazon.com/secretsmanager/latest/userguide/cfn-example_reference-secret.html
It is assumed that it would be difficult to accept this request since you wrote in your blog that lambroll only does processes that can be performed by Lambda API, but I created the issue because it might be some of your inspiration.
(Or if you have any ideas to resolve this situation, I feel really appreciated to hear that!)
Thank you.
The text was updated successfully, but these errors were encountered: