-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
I have a standard setup:
SAM-template.yml file contains
--- AWS Rest API
--- Lambda Function
Swagger.yml file contains
--- REST Definition
In the above setup I am able to refer Lambda FunctionName in Swagger.yml
ABCApi:
Type: AWS::Serverless::Api
DependsOn:
- FunctionA
- FunctionB
Properties:
StageName: dev
DefinitionUri: ./swagger.yml
Variables:
RefA: !Ref FunctionA
RefB: !Ref FunctionB
IN Swagger URI I can use RefA and RefB variables:
uri: !Sub arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:xxxxxxxxxx:function:${RefA.FunctionName}/invocations
This Works.
Now I am trying to pass Lambda Functions Arn
instead of just the name - but that won't work
Like this
ABCApi:
Type: AWS::Serverless::Api
DependsOn:
- FunctionA
- FunctionB
Properties:
StageName: dev
DefinitionUri: ./swagger.yml
Variables:
ArnA: !GetAtt FunctionA.Arn
IN Swagger for uri
If I use the ArnA variable it error's out:
uri: !Sub arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:xxxxxxxxxx:function:${ArnA}/invocations
Why Name can be passed but Arn cannot be?
Please note I have already read the alternative of using AWS Transform by inlining the Swagger in cft directly.
I am very curious to understand why approach A is feasible and not B. If Name is known, why ARN won't be known by this time?