We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
cfn-lint 1.16.1 / git v1.16.1-5-g07652d4a4
Mac
cfn-lint fails to resolve Fn::ForEach when values array comes from Map with AccountId key
cfn-lint
Fn::ForEach
AccountId
$ cfn-lint mapt.yaml E0001 Error transforming template: Fn::ForEach could not be resolved mapt.yaml:11:7
cfn-lint passes
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::LanguageExtensions Mappings: AccountMap: 12345678901: Emails: - [email protected] Resources: 'Fn::ForEach::Subscriptions': - Email - !FindInMap [AccountMap, !Ref AWS::AccountId, Emails] - 'SubscriptionFor&{Email}': Type: AWS::SNS::Subscription Properties: TopicArn: "arn:aws:sns:us-east-1:12345678901:my-sns-topic" Protocol: email Endpoint: !Ref Email
The text was updated successfully, but these errors were encountered:
Still fails if the found list is empty. Does this need a new issue?
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::LanguageExtensions Mappings: AccountMap: '012345678901': Emails: [] Resources: 'Fn::ForEach::Subscriptions': - Email - !FindInMap [AccountMap, !Ref AWS::AccountId, Emails] - 'SubscriptionFor&{Email}': Type: AWS::SNS::Subscription Properties: TopicArn: "arn:aws:sns:us-east-1:012345678901:my-sns-topic" Protocol: email Endpoint: !Ref Email
$ cfn-lint map3747.yaml E0001 Error transforming template: Fn::ForEach could not be resolved map3747.yaml:10:7
It only fails if first map entry has empty list, i.e. this also fails:
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::LanguageExtensions Mappings: AccountMap: '012345678901': Emails: [] '123456789012': Emails: - [email protected] Resources: 'Fn::ForEach::Subscriptions': - Email - !FindInMap [AccountMap, !Ref AWS::AccountId, Emails] - 'SubscriptionFor&{Email}': Type: AWS::SNS::Subscription Properties: TopicArn: "arn:aws:sns:us-east-1:012345678901:my-sns-topic" Protocol: email Endpoint: !Ref Email
$ cfn-lint map3747.yaml E0001 Error transforming template: Fn::ForEach could not be resolved map3747.yaml:13:7
But ths passes:
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::LanguageExtensions Mappings: AccountMap: '123456789012': Emails: - [email protected] '012345678901': Emails: [] Resources: 'Fn::ForEach::Subscriptions': - Email - !FindInMap [AccountMap, !Ref AWS::AccountId, Emails] - 'SubscriptionFor&{Email}': Type: AWS::SNS::Subscription Properties: TopicArn: "arn:aws:sns:us-east-1:012345678901:my-sns-topic" Protocol: email Endpoint: !Ref Email
$ cfn-lint map3747.yaml $
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
CloudFormation Lint Version
cfn-lint 1.16.1 / git v1.16.1-5-g07652d4a4
What operating system are you using?
Mac
Describe the bug
cfn-lint
fails to resolveFn::ForEach
when values array comes from Map withAccountId
keyExpected behavior
cfn-lint passes
Reproduction template
The text was updated successfully, but these errors were encountered: