-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Changing a CustomResource resourceType
or lambdaProvider
requires deleting and recreating the custom resource
#1061
Comments
resourceType
requires deleting and recreating the custom resource resourceType
or lambdaProvider
requires deleting and recreating the custom resource
Somewhat related to #847 |
I think tying the resource id to its type makes sense. Should be straightforward to incorporate the type into the logical ID. It might be trickier to do that with the service token because it is resolved at deploy time. For the specific case where users pass in a lambda that uses local assets, we might be able to incorporate the asset hash into the logical ID which will achieve a similar affect I think. |
The specific use case of local-asset lambdas is what broke for me, so fixing that use case would be sufficient for now. |
I'm a little confused though. I'm changing the source and redeploying all the time, feels like, and I've never run into this. Updating the source of a Lambda doesn't change its ARN. If you change the resourceType or something immutable about the Lambda... sure, but that should be a rare occasion. Does the common case really give trouble as well? |
No, source redeploys don't trigger this; I was simply saying that if the detection for ServiceToken was supported for local source lambdas only (as @eladb describe) that it would meet my needs. In my specific case, I was refactoring my Constructs to create the lambda in a different part of the construct tree, which changed its generated name, and therefore it's ARN. |
This is not something we are able to fix given how custom resources work. |
#943 added support for custom resource types, which is great. However, updating the custom resource type is a destructive action that requires replacement; the CDK tries to show this as a "Replace" action, but CloudFormation doesn't allow it for the same logical ID.
The workaround is to change the name of the Resource in the CDK script, but it would better if the CDK was able to detect this and change the hash of the generated Logical ID accordingly.
The same is also true for the
ServiceToken
key from the lambda provider. This is a more common use case where the Lambda implementation of the custom resource has changed, which redeploys the Lambda under a new ARN. The workaround here is to change the Lambda to have specify afunctionName
, which will prevent the ARN from changing when the Lambda changes, though moving from an unnamed to a named Lambda still requires deletion and recreation as above.The text was updated successfully, but these errors were encountered: