如何解决无法在Cloudformation的Type:String字段中传递导入值
我有一个父堆栈,该堆栈导出了一个如下所示的角色arn:
Outputs:
ExportApiGatewayLambdaInnvocationRole:
Value: !GetAtt 'ApiGatewayLambdaInnvocationRole.Arn'
Export:
Name:
Fn::Sub: "${AWS::StackName}-ApiGatewayLambdaInnvocationRole"
现在,我有一个子堆栈,它试图引用从父堆栈导出的角色arn,如下所示:
StatusLambda:
Type: AWS::Lambda::Function
Properties:
FunctionName: !Sub '${Region}-Lambda'
Code:
S3Bucket: !Ref PackageRepository
S3Key: !Ref LambdaPackageLocation
Role:
- Fn::ImportValue: "parent-stack-ApiGatewayLambdaInnvocationRole"
Handler: Functions/JobStatusProvider/index.handler
Runtime: nodejs12.x
Timeout: 150
问题:角色字段的类型为String,并且不接受ImportValue函数。我该如何解决?请帮忙
错误:Value of property Role must be of type String
解决方法
Role应该只是String
,但是您正在创建列表。
以下应纠正该问题(假设其他情况正确):
StatusLambda:
Type: AWS::Lambda::Function
Properties:
FunctionName: !Sub '${Region}-Lambda'
Code:
S3Bucket: !Ref PackageRepository
S3Key: !Ref LambdaPackageLocation
Role: !ImportValue parent-stack-ApiGatewayLambdaInnvocationRole
Handler: Functions/JobStatusProvider/index.handler
Runtime: nodejs12.x
Timeout: 150
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。