-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add support for 'Fn::ForEach' intrinsic function #3636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0e2e118 to
83315b2
Compare
|
Rebased on latest develop branch |
|
@smasset-veolia If the goal is to bring this to SAM CLI, this is the wrong repo for that. You can find SAM CLI's repo: https://github.com/aws/aws-sam-cli This repo is specifically for SAM's conversion from SAM's Spec to raw CloudFormation Resources. SAM Supports Fn::ForEach and other intrinsics though the Please make sure to submit an Issue first before submitting PRs so we can discuss changes before time is put into editting the code. Closing this for now, if you believe there is something deeper the Spec needs to support, please create an Issue first. |
|
@jfuss as you know the If you look at the logs of the examples shared in the linked issue aws/aws-sam-cli#5647, you'll see the first place the code fails is actually in Here's an abbreviated version of the traceback log from the last comment in aws/aws-sam-cli#5647. If needed, I can open a specific issue in this repo too. Please reopen and review the PR. |
|
Rebased against latest develop branch after new release. |
|
@smasset-veolia can you please first create an issue first and link this PR in the issue for discussion? |
Done. See #3641 |
Inspired by aws/aws-cli#8096.
Issue #, if available #3641
Description of changes
The Fn::ForEach intrinsic function requires to add array entries in the
Resourcessection of the SAM template. Parts of the code only expect to find object entries keyed with a string and fail with errors like'list' object has no attribute 'get'.This PR brings similar changes to those merged in the
aws-clito theaws-sam-translatorcode used byaws-sam-cli(replacing the array with the resource fragment provided with theFn::ForEachloop definition).Description of how you validated changes
On top of adding more local tests I've run
sam buildandsam validatecommands on a local environment with edited versions ofaws-sam-translatorandaws-sam-clipip packages.I've replaced calls to
resource_dict.get("Type")orresource_dict.get("Metadata")with the proposed code changes in each location where the commands would fail until they passed.Checklist
Examples?
Please reach out in the comments if you want to add an example. Examples will be
added to
sam initthrough aws/aws-sam-cli-app-templates.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.