question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for building nested stacks with SAM resources

See original GitHub issue

Describe your idea/feature/enhancement

I would like for it to be possible to deploy a CloudFormation template which contains SAM resources and a nested stack which template in turn also contains SAM resources, without having to update the TemplateURL property of the nested stack in a separate, custom step.

Currently, when both the parent stack and nested stack contain SAM resources, they have to be built separately. This means that the TemplateURL property that refers to the nested stack’s template is going to be wrong, not pointing to the template prepared by sam build. It would be great if this relation is kept during the build step, so packaging will still work as normal.

Proposal

(I don’t know enough details about SAM CLI to know how realistic any proposal that I have is.)

  • Add a parameter to the build command that allows you to list your nested templates.
  • Somehow find the TemplateURL of any AWS::CloudFormation::Stack resource in a template and verify whether it contains SAM resources.

Additional Details

  • In issue #936 it was mentioned that nested templates are not yet supported in any SAM CLI commands and that it needed a general issue.
  • Putting the nested stack into SAR can work for some of the solutions out there, but not all resource types are supported by SAR so this can still be a problem.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:45
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
michaelgwgutierrezcommented, Oct 16, 2019

I too would like to see this feature. Currently as a workaround you can run “sam build” on all the nested SAM projects and then build/package/deploy from the parent SAM. A recursive SAM build could be added to projects using nested SAM applications.

4reactions
aahungcommented, Mar 3, 2021

Building resources in nested stack is enabled by default in #2662, to be released

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using nested applications
A serverless application can include one or more nested applications . ... Paste the SAM template section into the Resources: section of the...
Read more >
AWS SAM Accelerate and nested stacks - Serverless Land
Fine out how to increase development velocity by using AWS SAM Accelerate with AWS CloudFormation nested stacks.
Read more >
Speeding up incremental changes with AWS SAM Accelerate ...
In this blog post, I show how to increase development velocity by using AWS SAM Accelerate with AWS CloudFormation nested stacks.
Read more >
AWS::Serverless::Application - Amazon Web Services 文档
Nested applications are deployed as nested AWS::CloudFormation::Stack resources ... resource as CREATE_COMPLETE in the parent stack and resumes creating the ...
Read more >
How do I implement Nested Stacks in AWS Cloud formation?
You can use the Cloudformation Stack Resource to implement nested Stacks in CloudFormation. The template url will be resolved by using the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found