I’m trying to use a “mappings” section in the serverless.yml file and I’m getting an error that I can’t quite understand.
Here is how I’m trying to use it (i left some resources out to isolate the issue):
resources:
Mappings:
S3HostedZoneIds:
us-west-2: Z3BJ6K6RIION7M
ca-central-1: Z1QDHH18159H29
Resources:
DnsRecord:
# See this for more details on how to create DNS Record for a bucket:
# https://www.serverlessops.io/blog/static-websites-on-aws-s3-with-serverless-framework
Type: "AWS::Route53::RecordSet"
Properties:
AliasTarget:
DNSName: s3-website-#{AWS::Region}.amazonaws.com
# https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
HostedZoneId: Fn::FindInMap
- S3HostedZoneIds
- Ref "#{AWS::Region}"
HostedZoneId: ${ssm:/${self:provider.stage}/route53/clearcareonline_zone_id}
Name:
Ref: SafeModeStaticSite
Type: 'A'
I get this error:
The CloudFormation template is invalid: Template format error: Every Mappings member us-west-2 must be a map
I think I’m doing a newbie error when using “mappings”, but I can’t quite figure it out.