amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

Adding cutom cloudformation stack under new category

Open eelzinaty opened this issue 6 years ago • 3 comments

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.

eelzinaty avatar Feb 04 '20 08:02 eelzinaty

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.

UnleashedMind avatar Feb 04 '20 20:02 UnleashedMind

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

eelzinaty avatar Feb 05 '20 05:02 eelzinaty

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

github-actions[bot] avatar May 26 '21 16:05 github-actions[bot]