Terraform returning single AMI

Hi,

I have a piece of code to return AWS AMIs. But it is returning a single AMI ID. What could be wrong with the code ? On purpose, I am not keeping filters. I am trying to get list of multiple AWS AMIs.


data "aws_ami" "myamis" {
  most_recent = true
  owners = ["amazon"] # AWS
}

output "amis" {
    value = data.aws_ami.myamis.*.id

}

what I am doing wrong ?
Your input is highly appreciated. Thank you

This limits the result to the most recent AMI.

The aws_ami data source is intended for declaring a dependency on exactly one external AMI. It does not support returning multiple AMIs.

The hashicorp/aws provider has a separate data source aws_ami_ids which can return the IDs of zero or more AMIs matching given criteria.

However, retrieving all AMIs owned by amazon may not be a sufficient filter for useful behavior because owner alone is typically not a sufficient discriminator for finding AMIs that provide particular functionality. The owners argument is primarily intended to use in conjunction with other filters to avoid selecting AMIs with other owners that might have similar naming schemes.