jzbruno / terraform-aws-lex-examples

Amazon Lex Bot examples from the AWS console implemented with the Terraform AWS Provider
8 stars 12 forks source link

Create Lex Bot in lex version 2 #5

Open nbmustafa opened 2 years ago

nbmustafa commented 2 years ago

Is it possible to create lex bot in lex version 2 with this code status?

jzbruno commented 2 years ago

Sorry, haven't been paying attention to this. I don't think so since the provider relies on the AWS Go SDK and only v1 support existed when this was created. I would file a feature request with the terraform aws provider project.

nbmustafa commented 2 years ago

@jzbruno would be really great if you can work on that, AWS is highly recommending customers to migrate to v2, looks like new features will only be released to v2. If you need any help there more than happy to help out.

jzbruno commented 2 years ago

@nashvan Unfortunately, I do not have any time to work on this. From what I can tell this will not be a small amount of work. The AWS Go SDK has a completely new structures for Lex v2. Even the function names aren't the same with some being split into multiple functions.

Lex v1 https://docs.aws.amazon.com/sdk-for-go/api/service/lexmodelbuildingservice/

Lex v2 https://docs.aws.amazon.com/sdk-for-go/api/service/lexmodelsv2/

For example, a quick look shows that, to create and update a bot in v1 you need this function call and input type

https://docs.aws.amazon.com/sdk-for-go/api/service/lexmodelbuildingservice/#LexModelBuildingService.PutBot https://docs.aws.amazon.com/sdk-for-go/api/service/lexmodelbuildingservice/#PutBotInput

But for v2 you need these functions and input types

https://docs.aws.amazon.com/sdk-for-go/api/service/lexmodelsv2/#LexModelsV2.CreateBot https://docs.aws.amazon.com/sdk-for-go/api/service/lexmodelsv2/#CreateBotInput https://docs.aws.amazon.com/sdk-for-go/api/service/lexmodelsv2/#LexModelsV2.UpdateBot https://docs.aws.amazon.com/sdk-for-go/api/service/lexmodelsv2/#UpdateBotInput

They are completely different structures. Further the attributes that are exposed by the bot input types and exposed by Terraform config are completely different. You'll notice in v1 the bot has various statements and prompts associated with it, and in v2 these are not present which implies you need to manage those independently.

All this means we can't simply make a copy of the existing resources and make small adjustment, a lot of translation will need to be done to deal with the differences in behavior. Everything has to be redone.

Sorry for the bad news. If you would like to work on this I can answer questions or give advice but will not be able to actively contribute.

Jack