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

AWS::Lambda::Alias Resource Provider #9100

Merged
merged 5 commits into from Sep 12, 2023
Merged

Conversation

pinzon
Copy link
Member

@pinzon pinzon commented Sep 8, 2023

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 model

Changes

  • New Resource provider
  • Test uses the attribute and is AWS validated

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.

@github-actions
Copy link

github-actions bot commented Sep 8, 2023

LocalStack Community integration with Pro

       2 files         2 suites   1h 20m 12s ⏱️
2 180 tests 1 697 ✔️ 483 💤 0
2 181 runs  1 697 ✔️ 484 💤 0

Results for commit c978935.

♻️ This comment has been updated with latest results.

@pinzon pinzon changed the title AWS::Lambda::Alias Resource Provide AWS::Lambda::Alias Resource Provider Sep 8, 2023
@pinzon pinzon added the semver: patch Non-breaking changes which can be included in patch releases label Sep 8, 2023
@coveralls
Copy link

coveralls commented Sep 8, 2023

Coverage Status

coverage: 79.781% (+0.1%) from 79.672% when pulling 5f7aa69 on ref/lambda-alias-res-prov into 1406450 on master.

"""
model = request.desired_state
lambda_ = request.aws_client_factory.lambda_
lambda_.delete_alias(
Copy link
Member

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? 🤔

Comment on lines 76 to 80
create_params = {
k: v
for k, v in model.items()
if k in ["FunctionName", "FunctionVersion", "Name", "Description", "RoutingConfig"]
}
Copy link
Member

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)

Comment on lines 86 to 97
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,
)
Copy link
Member

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? 🤔

Copy link
Member

@dominikschubert dominikschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor nit 👍

Comment on lines 95 to 98
return ProgressEvent(
status=OperationStatus.IN_PROGRESS,
resource_model=model,
)
Copy link
Member

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.

@pinzon pinzon merged commit b509c56 into master Sep 12, 2023
10 of 11 checks passed
@pinzon pinzon deleted the ref/lambda-alias-res-prov branch September 18, 2023 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants