Some custom resources may need to refer to Lambda functions. For example, defining an S3 bucket with events triggering lambda functions, or creating a user with access to a specific function.
It would typically be done with something like this:
Fn::GetAtt:
- MyLambdaFunction
- Arn
The problem is that with the initial deployment, the custom resources are created before the functions exist, and then this references an undefined function.
My current workaround is to first do an initial deployment without any custom resources, then do a second one with the custom resources. Once the functions have been deployed once, this works.
Are there any other suggestions for doing this?