我在cloudformation模板中定义了aws apigateway,如下所示:
PptApi:
Type: 'AWS::Serverless::Api'
Properties:
StageName: !ImportValue StageName
DefinitionBody:
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Location: !Join [ "", [ "s3://", !Ref S3APIBucket, "/api_ppt.yaml" ] ]
摇摇欲坠的Yaml模板如下:
---
swagger: "2.0"
info:
version: "2018-06-26T08:03:26Z"
title:
Fn::Join: ["", ["full-ppt-", "${Fn::GetAtt: PptApi.StageName}"]]
basePath:
Fn::Join: ["", ["/", "${Fn::GetAtt: PptApi.StageName}"]]
它会很好地创建API网关,除了标题解析为:full-ppt-${Fn::GetAtt: PptApi.StageName}
而不是full-ppt-demo
但是,basePath会按预期解析为/demo
(这是阶段名称变量)。为什么它在一种情况下起作用而在另一种情况下不起作用?