Data aws_ami does not return the latest AMI from marketplace

While using terraform to get the latest AMI ID of the product listed, it is getting the previous version.

product code: azespe814tygw07vf24qp19mi

If we search with the exact name, it is not returning any.
If we use the describe-mages CLI, we get both AMI listed, but we see a difference

The terraform always returns 8.9 version as the latest, and we can launch

“Name”: “STC-BYOL8.9-b986e134-3bc6-4a23-9ba6-e09db08a07fa”,

Terraform doesn’t list this AMI when filter with this name.

“Name”: “STC-BYOL-8-10-0-b986e134-3bc6-4a23-9ba6-e09db08a07fa”,

data “aws_ami” “stc-ami” {
executable_users = [“self”]
most_recent = true
owners = [“self”, “aws-marketplace”]

filter {
name = “product-code”
values = [“azespe814tygw07vf24qp19mi”]