我试图通过堆栈参数将资源(ApiGatewayRestApi和自定义授权程序)传递给嵌套堆栈,但是,它们会随Embedded stack <stack_name> was not successfully created: The following resource(s) failed to create
一起失败。这是我在无服务器中的设置:
父叠加
{
...
"NestedStack": {
"Type": "AWS::CloudFormation::Stack",
"Properties": {
"Parameters": {
"ServerlessDeploymentBucket": {
"Ref": "ServerlessDeploymentBucket"
},
"ApiGatewayRestApi": {
"Ref": "ApiGatewayRestApi"
},
"AuthDashjwtApiGatewayAuthorizer": {
"Ref": "AuthDashjwtApiGatewayAuthorizer"
},
},
"TemplateURL": "..."
}
},
}
嵌套筹码
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Nested Stack",
"Parameters": {
"ServerlessDeploymentBucket": { "Type": "String" },
"ApiGatewayRestApi": {
"Description": "Rest API",
"Type": "String"
},
"AuthDashjwtApiGatewayAuthorizer": { "Type": "String" },
},
"Resources": {
"ApiGatewayMethodEventsEventidVarStreamsPost": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"HttpMethod": "POST",
"RequestParameters": {},
"ResourceId": { "Ref": "ApiGatewayResourceEventsEventidVarStreams" },
"RestApiId": { "Ref": "ApiGatewayRestApi" },
"AuthorizationType": "CUSTOM",
"AuthorizerId": { "Ref": "AuthDashjwtApiGatewayAuthorizer" },
...
}
...
}
...
}
我没有正确引用或传递参数吗?
根据评论进行更新 除非我遗漏了某些内容,否则控制台CF部分中唯一的错误消息是:
Embedded stack <stac_name> was not successfully created: The
following resource(s) failed to create: [PatchDasheventLogGroup,
PostDashstreamLogGroup, GetDashstreamsLogGroup, GetDasheventsLogGroup,
ApiGatewayRestApi, GetDasheventLogGroup, PostDasheventLogGroup,
AuthDashjwtApiGatewayAuthorizer]
就日志组而言,它们看起来像这样:
"GetDasheventLogGroup": {
"Type": "AWS::Logs::LogGroup",
"Properties": {
"LogGroupName": "/aws/lambda/live-api-local-get-event"
}
}
更新2 日志组问题是由于这些日志从父堆栈移动到嵌套堆栈并需要新名称。在我发现的LogGroup文档中:
如果指定名称,则无法执行需要替换此资源的更新。您可以执行不需要或有一些中断的更新。如果必须替换资源,请指定新名称。
这看起来似乎已经解决了这个问题......需要进行更多测试才能确认!
答案 0 :(得分:1)
来自@speshak的评论最终引出了我的答案。我不需要按Failed
州进行过滤,而是Deleted
。这允许我查看已创建的嵌套堆栈的日志,然后使用更具体的消息传递进行删除。
最终向我展示的是update-stack
进程将嵌套堆栈应用于我当前的设置,然后从根堆栈中删除所有资源。所以真正的问题是我无意中尝试创建重复资源 - AWS在嵌套堆栈中看到了与根堆栈匹配的资源,并且即使资源已从根堆栈中删除,也会出现验证错误。 ..最终。