Hi,
I’m trying to query attributes of specific AMIs by ID without limiting the search to a specific owner. Using the aws cli, this can be accomplished by leaving out the --owners argument. The API documentation suggests the same strategy.
Owner.N […] Omitting this option returns all images for which you have launch permissions, regardless of ownership.
Unfortunately this doesn’t appear work currently for Terraform 0.12.21.
data “aws_ami” “test” {
for_each = var.instances
filter {
name = “image-id”
values = [each.value[“ami_id”]]
}
}
Error: Missing required argument […] The argument “owners” is required, but no definition was found.
It also fails with a list consisting of an empty string, a list with a single null, or just null. If this source is correct and up to date, that’s not a surprise. The schema marks owners as a mandatory list of at least 1 item that is not a zero value.
Is there another way to scope the search as anything the account has launch permission for, or a different mechanism to fetch AMI metadata such as name and description based on its id?