Terraform uses data sources to read existing infrastructure details before creating or updating resources. In the example, Terraform first reads the latest Amazon Linux AMI ID using a data source, then creates an EC2 instance resource using that AMI. The execution flow starts with reading data sources, then proceeds to resource creation. Variables track the AMI ID after reading the data source and the EC2 instance ID after resource creation. Beginners often wonder why data sources run first, which is to provide necessary info for resource creation. Data sources do not create or modify infrastructure; only resources do. If data source info changes, Terraform fetches the new data on the next apply, which may affect resource updates.