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 Nested Stack

See original GitHub issue

Hi,

I have question. Does Troposphere support CF nested stack? Some thing like this post http://cloudacademy.com/blog/understanding-nested-cloudformation-stacks/?

{
   "AWSTemplateFormatVersion": "2010-09-09",
   "Resources": {
       "ChildStack01": {
           "Type": "AWS::CloudFormation::Stack",
           "Properties": {
               "TemplateURL": "https://s3.amazonaws.com/cloudformation-templates-us-east-1/VPC.template",
               "TimeoutInMinutes": "60"
           }
       },
       "ChildStack02": {
           "Type": "AWS::CloudFormation::Stack",
           "Properties": {
               "TemplateURL": "https://s3.amazonaws.com/cloudformation-templates-us-east-1/Subnet.template",
               "Parameters": {
                  "VpcId" : { "Fn::GetAtt" : [ "ChildStack01", "Outputs.VpcID" ] },
               },
               "TimeoutInMinutes": "60"
           }
       }
   },
   "Outputs": {
       "StackRef": {
           "Value": { "Ref": "ChildStack02" }
       },
       "OutputFromNestedStack": {
           "Value": { "Fn::GetAtt": [ "ChildStack02", "Outputs.SubnetID" ]}
       }
   }
}

If yes, it’s great.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
toraclecommented, Jan 31, 2019

@tammclaughlin I found this SO answer is useful.

Part of my cfn scripts are below:


Child stack 1 which has a useful resource.

t = Template()

Vpc = t.add_resource(VPC(
    'Vpc',
    EnableDnsSupport=True,
    CidrBlock='10.1.0.0/16',
    EnableDnsHostnames=True,
))

t.add_output(Output('Vpc', Value=Ref(Vpc)))

Parent stack.

t = Template()

t.add_resource(Stack(
    'Child1',
    TemplateURL=f'{baseUrl}/child1.template',
))

t.add_resource(Stack(
    'Child2',
    TemplateURL=f'{baseUrl}/child2.template',
    Parameters={
        'Vpc': GetAtt('Child1', 'Outputs.Vpc'),
    }
))

Child stack 2 which want to use a resource of child1.

t = Template()

t.add_parameter(Parameter(
    'Vpc',
    Type='String',
    Description='Vpc Ref'))

t.add_resource(elb.TargetGroup(
    'TargetGroup1',
    ...
    VpcId=Ref('Vpc'),  # finally I can reference a sibling stack's resource
))
2reactions
blueduskcommented, Jun 25, 2018

It would be great to have an example in examples folder.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with nested stacks - AWS CloudFormation
Nested stacks are stacks created as part of other stacks. You create a nested stack within another stack by using the AWS::CloudFormation::Stack resource....
Read more >
Use AWS CloudFormation with nested stacks - nClouds
AWS CloudFormation tutorial: Learn how to use dedicated AWS CloudFormation templates with common components to create nested stacks.
Read more >
serverless-plugin-nested-stacks
Write your nested stacks as regular cloudformation and easily integrate them with the Serverless Framework! This plugin handles: Adding the appropriate AWS:: ...
Read more >
SAM Accelerate support for nested stacks #3305 - GitHub
SAM CLI just launched SAM Accelerate, and this issue is to track adding support for nested stacks with sam sync --watch.
Read more >
Do you use CloudFormation nested stack? : r/aws - Reddit
Using a nested stack for the VPC is wonderful because you can pass the ... This message of having to harangue AWS support...
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