# How to create AWS Lex bot version 2 using terraform scripts

**URL:** <https://discuss.hashicorp.com/t/how-to-create-aws-lex-bot-version-2-using-terraform-scripts/52131>\
**Category:** AWS\
**Created:** [March 30, 2023, 9:47pm UTC](https://discuss.hashicorp.com/t/how-to-create-aws-lex-bot-version-2-using-terraform-scripts/52131 "2023-03-30T21:47:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bnathreddy1](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/bnathreddy1/32/20101_2.png) [@bnathreddy1](https://discuss.hashicorp.com/u/bnathreddy1)\
**Post date:** [March 30, 2023, 9:47pm UTC](https://discuss.hashicorp.com/t/how-to-create-aws-lex-bot-version-2-using-terraform-scripts/52131/1 "2023-03-30T21:47:10Z")

</div>

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
