-
Notifications
You must be signed in to change notification settings - Fork 249
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 user provided environment variable key for aws-lambda-dynamodb pattern #132
Comments
Thanks - this is an interesting idea and we'll take a look. It's important to remember that one of the tenets of Solutions Constructs is that they are consistent - that if someone uses one construct with DynamoDB that they know that other constructs with DynamoDB behave the same way (see the guidelines for each service in the DESIGN_GUIDELINES.md file. So this change would change the DESIGN_GUIDELINES.md file and require changing every similar occurrence (although off the top of my head it seems that this is unique to the combination of Lambda and DynamoDB). |
@biffgaut I've searched |
We’ll talk about it at our team meeting Monday – seems like a reasonable thing. This could be labeled a bug, because if you connect a Lambda function to 2 different tables then either one construct will overwrite the value of the other or the stack will crash when the variable names collide. That leads to a possible increase in scope – avoiding collisions. I would think that providing a name would be optional (if they don’t then we use a default) – so if they attach a function to 2 tables, we could:
Let us know your thoughts before Monday - thanks. |
For me, providing flexibility to change the default environment name would be fine, so if no name is provided, like you mentioned, patterns create the name for users, but if name is provided, patterns use the user provided name. :) |
OK, go ahead and move forward on this. The scope is all constructs where Lambda is accessing a resource (not where Lambda is being triggered), we see these: lambda-dynamodb The props attributes need to express what the variable represents and stress that is the variable name (to distinguish it from full environment variables which can be specified in the lambda properties), so use: TableEnvironmentVariableName?: string If the property is not specified, use the current default value. Update the README.md files documentation at the bottom like this:
I'll update the DESIGN_GUIDELINES.md file. |
Sounds good! |
Currently, the
aws-lambda-dynamodb
pattern creates a Lambda environment variableDDB_TABLE_NAME
by default, but it would be better if users can set up the default environment key.Use Case
Users can define the Lambda environment variable key. For example, if the DynamoDB table is for metadata of their services, they can set
METADATA_DYNAMODB_TABLE
instead ofDDB_TABLE_NAME
, and it would make more sense when they see the Lambda environment variables on the Lambda console.Proposed Solution
Maybe,
Other
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: