I have a set of yaml
templates (one root template and several childs) to create a root stack and nested stacks in the top level of an S3 bucket. It looks like:
my-cf-templates-bucket (S3 bucket)
├ root.yaml
├ child1.yaml
├ child2.yaml
├ ...
└ childN.yaml
In order to supply the TemplateURL
of the child templates, currently I make use of a parameter TemplateS3Bucket
for the bucket URL:
Parameters:
TemplateS3Bucket:
Description: The bucket url for templates
Type: String
Default: https://s3.eu-central-1.amazonaws.com/my-cf-templates-bucket
Resources:
ChildStack1:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Join ["/", [ !Ref TemplateS3Bucket, "child1.yaml"]]
Parameters:
ProjectName: !Ref ProjectName
ChildStack1:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Join ["/", [ !Ref TemplateS3Bucket, "child2.yaml"]]
Parameters:
ProjectName: !Ref ProjectName
# ...
ChildStackN:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Join ["/", [ !Ref TemplateS3Bucket, "childN.yaml"]]
Parameters:
ProjectName: !Ref ProjectName
The question is:
Is there a way (!GetAtt
etc.) to get the bucket URL of the S3 root template through which I create a stack in AWS CloudFormation console (not aws-cli).
Having such a way, I could intrinsically have the bucket url for the child templates and neither need to add them as overrideable parameters nor repeat the full bucket url for all the templateURL
properties of the child stacks.