# Terraform: Error: Your query returned no results. Please change your search criteria and try again.

**Code:** `Your query returned no results (data source)` · **Category:** Terraform · **Seen on:** Terraform, AWS

A data source (e.g. `aws_ami`, `aws_vpc`) found nothing matching its filters.

## Meaning

Fix the filters (name pattern, owners, tags), region/account (provider alias), or create the object first. Verify with the cloud CLI using the same filters. Marketplace/AMI names change; use `most_recent = true` with correct `owners`. Data sources run at plan time, so objects created in the same apply may not exist yet.

## Common causes

- Wrong filter values/name patterns
- Wrong region/account/provider alias
- AMI/image deprecated or renamed
- Data depends on a resource not created yet
- Missing permissions to list/describe

## Quick fix

1. Test the same filter with the CLI (`aws ec2 describe-images --filters ...`)
2. Set correct `owners`/region
3. Use `depends_on` or remove the data source for objects created in the same run

## Detailed fix by platform

### AWS

1. `aws ec2 describe-images --owners amazon --filters "Name=name,Values=al2023-ami-2023*" --query 'Images[].Name'`

## How to diagnose

1. **Filters** — Match?
2. **Region** — Right?
3. **Order** — Created earlier?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/terraform/data-source-returned-no-results)
