Expose sourceHash on AssetCode? #4901
Labels
@aws-cdk/assets
Related to the @aws-cdk/assets package
@aws-cdk/aws-lambda
Related to AWS Lambda
feature-request
A feature should be added or improved.
p2
Thanks for CDK!
I would like to be able to access the sourceHash of an AssetCode's private asset property.
Use Case
I have a CustomResource and I would like to trigger the associated lambda to run whenever the hash of a certain AssetCode changes. To do this I update a property whenever the AssetCode changes:
Proposed Solution
I can workaround the issue by copying the source to AssetCode and using it in my project. The only changes I (seemingly) needed to make were to add a
public sourceHash?: string
property and to update the bind method to setthis.sourceHash
when the Asset is instantiated.Is there a reason this couldn't be added to AssetCode? A better way to trigger the lambda for a CustomResource only when the contents of an AssetCode changes?
Other
Related issue: #2595
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: