2

I am new to cloud formation templates. I am trying to organize the templates based on AWS services so that I can easily manage it. For example, iam-roles in one file, dynamodb tables on another, s3, lambda resources in individual files. When I try to make a master file from these partials I am able to include only one partial in the resource section on Fn::Transform. I need two suggestions, am I going in the right direction? and how to include all the partials into my main.yml? enter image description here

Resources:
  "Fn::Transform":
    Name: 'AWS::Include'
    Parameters:
      Location: 
        Fn::Sub: "s3://s3url/iam-roles.yml"
  "Fn::Transform":
    Name: 'AWS::Include'
    Parameters:
      Location: 
        Fn::Sub: "s3://s3url/ddbtables.yml"

The above code definitely throws an error. How to merge these partials?

Ada Pongaya
  • 405
  • 4
  • 18

1 Answers1

2

From the images you have shared in the question, the templates you have created have to be included using AWS::CloudFormation::Stack.

Fn::Transform is a macro which is used to do preprocessing of a cloudformation templates. For example, we can do search and replace of some strings in the cloudformation templates using Macros.

robert
  • 8,459
  • 9
  • 45
  • 70
  • I hope by use AWS::CloudFormation::Stack will create a nested stack!. my ask is how to create everyting in a single stack with multiple files. – Ada Pongaya Sep 21 '20 at 04:11
  • 1
    Yes. AWS::CloudFormation::Stack will create a nested stack. I don't think it is possible to create everything as a single stack with multiple files. – robert Sep 21 '20 at 04:45
  • One more ask here, is it possible to use some standard tags reusable? I mean there is `tags.yml` which can be used in every resource, is that possible? – Yougeshwar Khatri May 04 '23 at 13:12