How to create AWS Lex bot version 2 using terraform scripts

I am able to create AWS Lex bot using terraform script. But by default it creates bot in V1 console. But we need to Lex bot in V 2 using the terraforms scripts.
This is the script that created the bot on V1 console.

    resource "aws_lex_bot" "chatbot_autoreply" {
                depends_on = [ aws_lex_intent.Fallbacktwo ]
                name = "Chat_Test"
                child_directed = false
                abort_statement {
                            message {
                                    content_type = "PlainText"
                                     content      = "Script aborted refer abort_statement"
                            }         
                }
               intent {
                       intent_name    = "Fallbacktwo"
                       intent_version = "1"
                }
       }

      resource "aws_lex_intent" "Fallbacktwo" {
                       create_version = true
                       name           = "Fallbacktwo"

                       fulfillment_activity {
                                 type = "ReturnIntent"
                      }

            }

Thank You

1 Like