Let's play around with our VPC a bit to better understand how resource dependencies are handled. Instead of adding a subnet, let's destroy the complete infrastructure we have so far and then plan creation from scratch:
$> terraform destroy
$> terraform plan
# ...
+ aws_subnet.public
availability_zone: "<computed>"
cidr_block: "10.0.1.0/24" map_public_ip_on_launch: "false"
vpc_id: "${aws_vpc.my_vpc.id}"
# ...
Terraform doesn't know the VPC ID yet, so it doesn't show it to you in the plan. Let's apply the template and observe the order of resource creation:
$> terraform apply
aws_vpc.my_vpc: Creating...
cidr_block: "" => "10.0.0.0/16"...