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

Add the ability to customize lambda function upload name #49

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

glaurungg
Copy link

This allows lambdas uploaded to gordon to contain a chosen base function
name, combined with "AWS::Region" and "Stage" references to keep
uniqueness across stages / regions.

While I believe this is a generally positive feature that allows for greater customization, my specific use case is a chain of three lambda functions, the first one invoking the second lambda multiple times, and each of those second lambda's invocations invoking the third lambda once. With the current way that gordon deploys lambdas, their names all contain what I believe is the hexdigest of the lambda's zip file, making it hard to address gordon lambdas from within other lambdas.

This patch allows both strings and Refs to be specified for the function-name config value, allowing applications to much more easily programmatically determine other lambdas' names via the contexts field.

This allows lambdas uploaded to gordon to contain a chosen base function
name, combined with "AWS::Region" and "Stage" references to keep
uniqueness across stages / regions.
Fixes a small bug where the app name was only being prepended to string
type lambda function names and not troposphere.Ref types.
Because of the timing of when troposhere.Ref objects are resolved in a
Fn::Join, the format of rule names is now consistently
"AppName-LambdaName-Stage-AWS::Region"
@ausmith
Copy link
Contributor

ausmith commented Jun 29, 2016

Coolness, should there be a test for this new functionality though? At least to verify that gordon knows what to do with the function names across lambdas?

@owais
Copy link

owais commented Aug 1, 2016

This would be very helpful!!

@jakubincloud
Copy link

Waiting for this feature to be added to the core

@ninjabear
Copy link
Contributor

+1 we're using a similar setup where the lambda name is important for pulling configuration from dynamodb

@jorgebastida
Copy link
Owner

I am not 100% sure if this would work as intended. Based on my experience with Cloudformation, when the name of the resource is specified it then becomes impossible to update it using Cloudformation. The problem is that once the resource exists if CF needs to replace it, it can't create the new one because the names collide.

That been said (because of the lambda versions) that might not be the case here. See http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html It looks like the onlychange that requires Replacement is the funcion-name itself which by definition would not be aproblem

Has anybody tried this live and manage to update the lambda after the name is fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants