Amplify-cli: Adding cutom cloudformation stack under new category

Created on 4 Feb 2020  路  2Comments  路  Source: aws-amplify/amplify-cli

Describe the bug
I am adding a custom cloudformation stacks under a new category, let's call it "permission". Under this folder am adding another 4 folders where each one of these folders represents different group of permissions (resources). Everything works fine until the cli creates the main cloudformation stack, nested-cloudformation-stack.yml. It creates 4 resources with different names but points to the same cloudformation template on S3.

Amplify CLI Version
4.13.0

To Reproduce
1- Add a new folder called permission
2- Add two subfolders called perm1 & perm2
3- Under each sub-folder add two json files called parameters.json and template.json
4- Add necessary configurations and definitions to backend-config.json.
5- run amplify env checkout dev
6- check the generated main cloudformation template you will find two new resources that have been added but they are pointing to the same S3 file.

Expected behavior
Each resource under the new category should point to its own cloudformation template. I think you can do that easily by appending the resource folder name in the bucket name, i.e. https://s3.amazonaws.com/${deployment_bucket_name}/amplify-cfn-templates/${category_folder_name}/${resource_folder_name}/template.json

Screenshots
Generated Resources in main cloudformation template
Folder structure for new category and resources

Desktop (please complete the following information):

  • OS: Windows
  • Node Version: 12.1.0

Additional context
Add any other context about the problem here.

pending-response platform question

Most helpful comment

The Amplify CLI does require the CloudFormation template file name of each nested stack to be unique under the same category, otherwise the one that is uploaded the last will override the previously uploaded template files.
In your case, you can just decorate the template file names with prefixes such as data-manager-cloudformation-template.json, general-maanger-cloudformation-template.json etc.

All 2 comments

The Amplify CLI does require the CloudFormation template file name of each nested stack to be unique under the same category, otherwise the one that is uploaded the last will override the previously uploaded template files.
In your case, you can just decorate the template file names with prefixes such as data-manager-cloudformation-template.json, general-maanger-cloudformation-template.json etc.

Thank you @UnleashedMind , it works now! Although, I noticed that the templates should be postfixed with cloudformation-template.json.
Also, it will be great if you update the documentation to include such cases.

Thanks

Was this page helpful?
0 / 5 - 0 ratings