0

当我将内部 cloudformation 函数 !ImportValue 放在无服务器 api 模板的定义主体中的 Join 函数中时,它为什么不能解析为字符串?

此 cloudformation 模板:

  UserAPI:
    Type: 'AWS::Serverless::Api'
    Properties:
      StageName: !ImportValue StageName
      DefinitionBody:
          'Fn::Transform':
            Name: 'AWS::Include'
            Parameters:
              Location: !Join [ "", [ "s3://", !ImportValue S3APIBucket, "/api_user.yaml" ] ]

会产生以下错误:

Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: The value of parameter Location under transform Include must resolve to a string, number, boolean or a list of any of these.

但是,如果我将最后一行替换为:

Location: !Join [ "", [ "s3://", !Ref S3APIBucket, "/api_user.yaml" ] ]

并将 S3APIBucket 作为参数它工作正常。或者不要使用 !Join 并且只对 s3 存储桶名称进行硬编码,这也可以正常工作。

4

0 回答 0