简体   繁体   中英

How to Include/Reference Multiple Resource files in CloudFormation?

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? 在此处输入图像描述

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM