When using CloudFormation with SAM, and creating a SAM function - a log group for that lambda may or may not be created.
The existence of the log group when the SAM function resources have entered the CREATE_COMPLETE
state depends on the configuration of the lambda (e.g. if provisioned concurrency is set) and/or other things that are not controlled by the CloudFormation template (e.g. a lambda with the same name was previously created and ran, etc)
In a nested stack (or another dependent resource), I need that log group in order to create a subscription for it - but creating it if it already exists leads to a failure.
Creating a new log group with a different and unique name does not help as there is no way to control to which log group a lambda will log (it will always log to a log group with its own name).
Is there a way to ensure the existence of the log group with a certain name, but without failing the stack when it already exists?