aws / aws-cli

Universal Command Line Interface for Amazon Web Services
Other
15.15k stars 4.03k forks source link

Feature request: Support publishing SAM template to SAR that leverages an existing macro #8786

Closed ShanmugapriyanSP closed 2 weeks ago

ShanmugapriyanSP commented 2 weeks ago

Describe the feature

The Serverless Application Repository (SAR) should support the use of custom macros within AWS Serverless Application Model (SAM) templates. Currently, SAR does not support the usage of existing macros which limits the flexibility and customization available to users deploying serverless applications.

When we attempt to publish the SAM template using either aws serverlessrepo create-application or sam publish, we encounter the following error: Error: Resource with name [Transform] is invalid. Provided Transform ['AWS::Serverless-2016-10-31', 'MyMacro'] is unsupported. Please use one of the following: ['AWS::Serverless-2016-10-31']

Use Case

We need to transform SAM templates to meet specific requirements that are unique to our operational needs and workflows. Custom macros allow us to automate and enforce these transformations, ensuring consistency, compliance, and efficiency. For instance, we may need to include custom resource definitions or apply specific configuration settings by using the parameter overrides provided by the user. We want to centralise and use the code across our AWS child accounts by leveraging SAR.

Proposed Solution

Integration with Existing SAM Macros: Ensure that SAR can seamlessly integrate with the existing macro functionality provided by SAM, allowing users to leverage their current macro implementations without modifications.

Documentation and Examples: Provide comprehensive documentation and examples demonstrating how to define, use, and troubleshoot custom macros within SAR. This would help users to quickly adopt the new feature and understand its benefits and limitations.

Other Information

No response

Acknowledgements

CLI version used

2.17.8

Environment details (OS name and version, etc.)

Mac OS X | macOS Sonoma

tim-finnigan commented 2 weeks ago

Thanks for the feature request. This is a limitation on the CloudFormation side, here is a related issue opened a while back: https://github.com/aws/serverless-application-model/issues/859. I found an internal backlog item tracking this request. I'll add your +1 to that, and if you have any other details regarding your use that you want to add then please let me know. But support for this feature would need to be added on the CloudFormation side before the AWS CLI could support this. Also for issues involving the SAM CLI you can reach out here: https://github.com/aws/aws-sam-cli/issues.

github-actions[bot] commented 2 weeks ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

ShanmugapriyanSP commented 2 weeks ago

Thanks for the update.