【发布时间】:2020-12-28 19:05:48
【问题描述】:
我有一个父堆栈,它可以像这样导出一个角色:
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
问题:角色字段是字符串类型,不接受 ImportValue 函数。我该如何解决?请帮忙
错误:Value of property Role must be of type String
【问题讨论】:
-
您确定该角色是在您尝试在嵌套堆栈中使用它时创建的吗?您不应该在嵌套堆栈中设置
dependsOn属性吗?
标签: amazon-web-services amazon-cloudformation