Skip to content
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

Fn::ForEach Supported but an error is thrown on the CLI #12402

Open
jackylamhk opened this issue Mar 28, 2024 · 0 comments
Open

Fn::ForEach Supported but an error is thrown on the CLI #12402

jackylamhk opened this issue Mar 28, 2024 · 0 comments

Comments

@jackylamhk
Copy link

jackylamhk commented Mar 28, 2024

Issue description

When a Fn::ForEach block is included, the Serverless CLI throws an error:

Warning: Invalid configuration encountered
  at 'resources.Resources': unrecognized property 'Fn::ForEach::LoopName'

However, upon inspecting the generated CloudFormation template it seems to generates the loop resources fine.

Context

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-foreach.html

I would also suggest to add this to the documentation as it is already implicitly supported.

The correct syntax looks like:

resources:
  Transform: AWS::LanguageExtensions
  Resources:
    Fn::ForEach::LoopName:
      - VarName
      - - Foo
        - Bar
      - ${VarName}SomeResource:
          SomeProperty: !Ref VarName
          SomeNestedRef:
            Ref: !Sub ${VarName}Suffix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant