Creates a Lex bot and intent, and associates them with an Amazon Connect instance.

Terraform Template

data "aws_region" "current" {
}

resource "aws_connect_bot_association" "example" {
  instance_id = "aws_connect_instance.example.id"

  lex_bot {
    lex_region = data.aws_region.current.name
    name = aws_lex_bot.example.name
  }
}

resource "aws_lex_bot" "example" {

  abort_statement {

    message {
      content = "Sorry, I am not able to assist at this time."
      content_type = "PlainText"
    }
  }
  child_directed = false

  clarification_prompt {
    max_attempts = 2

    message {
      content = "I didn't understand you, what would you like to do?"
      content_type = "PlainText"
    }
  }

  intent {
    intent_name = aws_lex_intent.example.name
    intent_version = "1"
  }
  name = "connect_lex_bot"
  process_behavior = "BUILD"
}

resource "aws_lex_intent" "example" {
  create_version = true

  fulfillment_activity {
    type = "ReturnIntent"
  }
  name = "connect_lex_intent"
  sample_utterances = ["I would like to pick up flowers."]
}