Append another CloudFront Function to the created Distribution in static-website construct #78
Replies: 2 comments 5 replies
-
Also a bonus question: can I pass user and pass per env variables or per Secrets somehow instead of hardcoding them in the function? |
Beta Was this translation helpful? Give feedback.
-
Hey @InvisibleKind, thanks for reporting your use case :) ! Lift uses CDK under the hood. CDK generates logical id for each resources provisioned through a construct (in your case, for exemple, for the CloudFront distribution you're trying to reference). Those generated logical ids contains a small hash at the end to prevent collision with similar path to resources. You can use We are thinking of a way to extend construct on a more reliable basis (without hardcoding the generated hash), but in the mean time, you always have the possibility to eject from Lift, version generated CloudFormation and update the CloudFront logical id to match your liking. Once you've done so, you can specify the association using the FunctionAssociation property. |
Beta Was this translation helpful? Give feedback.
-
Hello again,
I'm making forward my journey to the serverless world :D
One of my next goals is to add Basic Auth to Cloudfront distributions, created in DEV and STAGE environments, and Cloudfront Functions is the perfect place for this functionality.
So I've added it under the resources:
The function is created, but I can't figure out, how can I attach it to the Cloudfront Distribution, created by lift. I assume I should do it in
resources.extensions
section and/or reference somehow with!GetAtt
, but have no idea how.Is there a way to achieve what I need?
Beta Was this translation helpful? Give feedback.
All reactions