我正在尝试将 aws 从一个帐户转移到另一个帐户。我使用former2 生成yaml 文件,当我尝试使用此yaml 文件在CloudFormation 中创建堆栈时,它返回此错误:
Template contains errors.: Template error: instance of Fn::Sub references invalid resource attribute context.arguments.deviceName
我无法向您展示整个代码,但 context.arguments.deviceName 的使用方式如下:
":deviceName" : { "S": "${context.arguments.deviceName}" }
它仅用于解析器。
我知道我并没有提供太多信息,但如果有人能指出我的方向,那就太棒了。
使用位置示例:
AppSyncResolver4:
Type: "AWS::AppSync::Resolver"
Properties:
TypeName: "Mutation"
FieldName: "addNewDevice"
DataSourceName: ""
RequestMappingTemplate: !Sub |
{
"version": "2017-02-28",
"operation": "UpdateItem",
"key": {
"id": $util.${SNSTopic.TopicName}.toDynamoDBJson($context.arguments.id),
},
"update" : {
"expression" : "SET deviceName = :deviceName, activeTo = :activeTo, trash = :trash, cloudActive = :cloudActive, clientId = :clientId, synchronized = :synchronized",
"expressionValues": {
":cloudActive" : { "BOOL": $ctx.args.cloudActive },
":synchronized" : { "BOOL": $ctx.args.synchronized },
":trash" : { "BOOL": $ctx.args.trash },
":deviceName" : { "S": "${context.arguments.deviceName}" },
":activeTo" : { "S": "${context.arguments.activeTo}" },
":clientId" : $util.${SNSTopic.TopicName}.toDynamoDBJson($ctx.args.clientId),
}
}
}
ResponseMappingTemplate: "$util.toJson($ctx.result)"
Kind: ""
ApiId: ""