Below is my Resources Section in CFN template. I want to create AWS Route53 Record Sets but the problem is that I need to hard code the number for iterations for the forEach as can be seen below under RecordSetLogicalId. I want those to come from the Mappings section of the CFN template so that I can create unequal number of record sets in different AWS Accounts. For example 3 in Dev and 5 in Prod. When I try to use FindInMap or Split functions, I get a cfn linting error ‘[cfn-lint] E0001: Error transforming template: Fn::ForEach values must be a list of 3 elements’
Resources:
Fn::ForEach::RecordSet:
- RecordSetLogicalId
- - Route53RecordSet
- Route53RecordSet2
- Route53RecordSet3
- ${RecordSetLogicalId}:
Type: AWS::Route53::RecordSet
Properties:
Name: !FindInMap
- !Ref Environment
- !Ref RecordSetLogicalId
- name
- DefaultValue: nonexistantclient-distribution
Type: CNAME
TTL: 90
HostedZoneId: !Ref Route53HostedZone
ResourceRecords: !FindInMap
- !Ref Environment
- !Ref RecordSetLogicalId
- resourceRecords
- DefaultValue: d3kk6er7266fqt.cloudfront.net