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

Model Lambda's Alias.updatePolicy in our AWS::Lambda::Alias L1 #1177

Closed
skinny85 opened this issue Nov 15, 2018 · 6 comments · Fixed by #1346
Closed

Model Lambda's Alias.updatePolicy in our AWS::Lambda::Alias L1 #1177

skinny85 opened this issue Nov 15, 2018 · 6 comments · Fixed by #1346
Labels
@aws-cdk/aws-lambda Related to AWS Lambda @aws-cdk/core Related to core CDK functionality feature-request A feature should be added or improved.

Comments

@skinny85
Copy link
Contributor

Some CloudFormation resources (the example I know is AWS::Lambda::Alias with its UpdatePolicy) have attributes that are not listed under the Properties key in a template. These are currently not available in our L1s.

They need to be added if we want to model these in the CDK.

@eladb
Copy link
Contributor

eladb commented Nov 15, 2018

Technically you should be able to use updatePolicy but the Alias update policy schema is not available there at the moment:

myResource.options.updatePolicy = {
  autoScalingReplacingUpdate: {
    willReplace: true
  }
}

Maybe we should convert this issue? And also add L2 support?

@skinny85 skinny85 changed the title Model attributes of CloudFormation resources that are not Properties in L1 Model Lambda's Alias.updatePolicy in our AWS::Lambda::Alias L1 Nov 15, 2018
@skinny85
Copy link
Contributor Author

Fair enough - I changed the title of the issue.

L2 support is exactly why I'm opening this issue - because I want to add it :).

@rix0rrr
Copy link
Contributor

rix0rrr commented Nov 19, 2018

@rix0rrr
Copy link
Contributor

rix0rrr commented Nov 19, 2018

L1 creation/update policies are not generated but hand-written, so it should be easy enough to add the appropriate policies for Alias:

https://github.com/awslabs/aws-cdk/blob/master/packages/@aws-cdk/cdk/lib/cloudformation/resource-policy.ts

@rix0rrr rix0rrr added @aws-cdk/core Related to core CDK functionality feature-request A feature should be added or improved. @aws-cdk/aws-lambda Related to AWS Lambda labels Nov 19, 2018
@skinny85
Copy link
Contributor Author

@rix0rrr but how to change the type of the UpdatePolicy in the Lambda alias L1? Right now, it's the same UpdatePolicy that's used in auto-scaling groups, and it's set in the Resource class itself.

How to go about changing the type of updatePolicy for AliasResource?

@rix0rrr
Copy link
Contributor

rix0rrr commented Nov 20, 2018

You don't, but you can just make the one UpdatePolicy type the union of all possible updatepolicy configurations. That is, you would add a CodeDeployLambdaAliasUpdate field to the current UpdatePolicy type.

That is how CloudFormation "thinks" about it as well. They don't have an UpdatePolicy per resource type page. Instead, they have a single UpdatePolicy page with all possible configurations under it:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda @aws-cdk/core Related to core CDK functionality feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants