Cloudformation模板Lambda环境变量错误-属性值变量必须是带有String的对象

时间:2018-11-08 16:41:01

标签: amazon-web-services aws-lambda amazon-cloudformation serverless-framework

我想使用cloudformation映射为我的lambda函数设置环境变量。因此,我正在使用0从映射中获取变量的值。但是我遇到了错误-Fn::FindInMap

Value of property Variables must be an object with String (or simple type) properties

1 个答案:

答案 0 :(得分:1)

您正在将DUB_CROSS_ACCOUNT_IAM_ROLE设置为数组。试试

 Environment:
    Variables:
      DUB_CROSS_ACCOUNT_IAM_ROLE:
        Fn::FindInMap:
        - DomainResourceMapping
        - DUBCrossAccountIAMRole
        - {Ref: Stage}

或使用简短语法

 Environment:
    Variables:
      DUB_CROSS_ACCOUNT_IAM_ROLE: !FindInMap [ DomainResourceMapping, DUBCrossAccountIAMRole, !Ref Stage