With the way that the CloudFormation workflow is set up, there is currently no mechanism of modifying the TestBotAlias within a CFN template. In the meantime a possible solution you can use is to create a new BotVersion when you are ready to test your bot and associate an AWS::Lex::BotAlias resource with templated bot version.
If there are any other questions please feel free to reach out again!
I was finally able to get this working (in AWS CDK)
While defining the lex bot:
test_bot_alias_settings = ( lex.CfnBot.TestBotAliasSettingsProperty( bot_alias_locale_settings=[ lex.CfnBot.BotAliasLocaleSettingsItemProperty( locale_id="en_US", bot_alias_locale_setting=lex.CfnBot.BotAliasLocaleSettingsProperty( enabled=True, code_hook_specification=lex.CfnBot.CodeHookSpecificationProperty( lambda_code_hook=lex.CfnBot.LambdaCodeHookProperty( code_hook_interface_version="1.0", lambda_arn=self.my_lex_lambda.function_arn, ) ), ), ) ], ), )
Create AWS::Lex::BotAlias with Lambdahook using Cloudformation is not workingAccepted Answerasked 9 months ago
Lambda error codeasked 2 years ago
Deleting CloudFormation Stacks using a shell scriptAccepted Answerasked 2 years ago
Slack Channel Integration with Amazon Lex Bot Not Workingasked 5 months ago
CloudFormation stack stuck in UPDATE_COMPLETE_CLEANUP_IN_PROGRESSAccepted Answerasked 10 months ago
Can't create Lambda code hook for Lex's TestBotAlias with CloudFormationasked 8 months ago
Why is there a long delay between CREATE_IN_PROGRESS event for a Lambda-backed CloudFormation custom resource and the Lambda function invocation?Accepted Answerasked 9 months ago
How to create lambda function with nodejs from cloudformation inline?Accepted Answerasked a year ago
Can you create API Gateway methods using a CloudFormation template without a Lambda proxy function?Accepted Answerasked 4 years ago
Create a github connection for app runner using cloudformationasked 6 months ago