Closed smasset-veolia closed 2 months ago
Hi there, thanks for opening this issue and for contributing to SAM. Seems like a valid request to me, I'll try to look through your PR early next week
We shouldn't be adding support for Fn::ForEach
in this repo and instead should be in SAM CLI. We shouldn't fail the way we do here but that doesn't mean we should be re-implementing it in SAM.
Context:
Intrinsics are supported through AWS::LanguageExtensions
. This is only available through deployments though and how SAM supports this today.
Instrinsics have caused multiple issues over the year for us and why we now recommend customers to use AWS::LanguageExtensions
with SAM now.
The issue here is not that SAM doesn't support Fn::ForEach
but that SAM CLI does not support AWS::LanguageExtensions
. SAM CLI issue regarding this: https://github.com/aws/aws-sam-cli/issues/5647
Agree with Jacob on this, didn't realize that SAM CLI doesn't support Language Extensions and thats what was causing the issue. Closing this issue for now, thanks again for bringing this up. Feel free to re-open if you want to discuss further.
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one.
hi @jfuss , as a customer, we would expect it to be working and integrate it well with the feature AWS provide. if this is not the right place, would you please raise the request in the right place and put a link here?
In addition, if this is right "Instrinsics have caused multiple issues over the year for us", why hasn't it been resolved or in the backlog to resolve.
when I was notified that cloud formation support for loop feature, I was super happy and write article to celebrate it. but I was disappointed that one of my favourite tool - sam does not work well with it.
if this is not going into the right direction, how would we recommend sam over terraform to others/clients
Hi @brianhhq https://github.com/aws/aws-sam-cli/issues/5647 this feature request to support Language Extensions in SAM CLI would be the right request to use as the issue is with the sam build
command rather than the actual transform
Description
The SAM CLI fails to parse templates using the
ForEach
intrinsic function to define resources. The build first fails inaws-sam-translator
code.Comments in a similar issue reported in the
sam-cli
project (aws/aws-sam-cli#5647) point to a fix recently merged in AWS CLI (aws/aws-cli#8096). Applying similar changes in bothaws-sam-translator
(see #3636) andaws-sam-cli
on a local test environment fixes the issue.Steps to reproduce
Run
sam build
with the example provided in the function reference documentationObserved result
The command fails in
aws-sam-translator
code with the following traceback:Expected result
The command shouldn't fail and output:
Additional environment details
sam --version
: reproduced with bothSAM CLI, version 1.121.0
andSAM CLI, version 1.123.0