我编写了terraform脚本,在AWS中创建一个lexbot。这是一个非常简单的脚本。name, child_directed, abort_statement, intent是"必需的";属性:aws_lex_bot"资源。
会抛出关于"意图"的错误。属性错误:创建Lex Bot (Chat_AutoReply): BadRequestException:资源找不到资源"Chat_AutoReply"中引用的"FallbackIntent"。选择另一个资源。
resource "aws_lex_bot" "chatbot-autoreply" {
name = "Chat_AutoReply"
child_directed = false
abort_statement {
message {
content_type = "PlainText"
content = "Script aborted refer abort_statement"
}
}
intent {
intent_name = "FallbackIntent"
intent_version = "1"
}
}
您必须创建aws_lex_intent,然后在aws_lex_bot
中使用它,例如:
resource "aws_lex_intent" "fallback" {
...
}
resource "aws_lex_bot" "chatbot-autoreply" {
name = "Chat_AutoReply"
child_directed = false
abort_statement {
message {
content_type = "PlainText"
content = "Script aborted refer abort_statement"
}
}
intent {
intent_name = aws_lex_intent.fallback.name
intent_version = "1"
}
}