What would be the proper way to have two different SAM templates, for two different GitLab repos, reference a shared resource? I would like a database to be created from within a SAM template, and I would like to be able to reference it by ARN within other SAM templates (without hardcoding it).
Each of the two repos has its own .gitlab-ci.yml file that runs sam build, sam package, and sam deploy. The template.yml creates a multiple roles, policies, layers, queues, lambdas, etc. There are multiple lambdas created within an individual repo, the code for each is in its own folder.
I've considered attempting to break up the templates into multiple parts and use some kind of nested templates, but I'm not sure yet how that could work exactly. I have also considered looking into possibilities with somehow sharing a CDK file by both repos. I have no idea where to start.
I have searched for a solution for quite awhile and nobody seems to be having a similar issue, which makes me question whether I fundamentally doing something wrong or that there an obvious answer... Any suggestions or links to tutorials on this would be helpful. Also, should I perhaps keep it to one lambda per repo?