I'm creating an AWS SAM template and would like to use mappings to store some commonly used paths. My mappings definitions look like that:
Mappings:
envs:
np:
vpcId: vpc-1412343432
prod:
vpcId: vpc-4123121323
paths:
example:
foo1: /{stage}/foo1/
foo2: /{stage}/foo2/
foo3: /{stage}/foo3/
and later in the template, I have a function definition with !findInMap
myFunc:
Type: AWS::Serverless::Function
Properties:
Handler: index.myFunc
Role: !GetAtt myFunc.Arn
Events:
foo:
Type: HttpApi
Properties:
Path: !FindInMap [ paths, example, foo1 ]
Method: get
ApiId: !Ref fooApi
When I run sam deploy it returns an error Event with id [foo] is invalid. Api Event must have a String specified for 'Path'
. It looks that findInMap returns empty value. Do you know what am I doing wrong?