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
AWS::Lambda::Alias Resource Provider #9100
Conversation
""" | ||
model = request.desired_state | ||
lambda_ = request.aws_client_factory.lambda_ | ||
lambda_.delete_alias( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you check if this also deletes the provisioned concurrency on AWS? 🤔
create_params = { | ||
k: v | ||
for k, v in model.items() | ||
if k in ["FunctionName", "FunctionVersion", "Name", "Description", "RoutingConfig"] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use the functions available in the imported util
package which should have a helper for this (if you want)
lambda_.put_provisioned_concurrency_config( | ||
FunctionName=model["FunctionName"], | ||
Qualifier=model["Id"].split(":")[-1], | ||
ProvisionedConcurrentExecutions=model["ProvisionedConcurrencyConfig"][ | ||
"ProvisionedConcurrentExecutions" | ||
], | ||
) | ||
|
||
return ProgressEvent( | ||
status=OperationStatus.SUCCESS, | ||
resource_model=model, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this is an async operation that might have to wait for the provisioned concurrency to actually be available. It could also be the case that they just leave that async and immediately return CREATE_COMPLETE though 🤷♂️ . Did you test this? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, minor nit 👍
return ProgressEvent( | ||
status=OperationStatus.IN_PROGRESS, | ||
resource_model=model, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to check if the context on AWS is something you can mutate because otherwise this provider wouldn't work on AWS since you're not passing the context back with the progress event. 🤔
For now please also pass the context object on return.
Motivation
The Generic Base model for the Lambda::Alias doesn't support the
ProvisionedConcurrencyConfig
attribute so I took the opportunity to code the resource provider for the modelChanges
Testing
The testing of the attribute requires the lambda to return a valid response due AWS running the function code before provisioning the concurrency config.