Interview Prep/Terraform/Providers, Resources and Data Sources

When is a data source read, and what happens if its arguments are unknown?

AdvancedConceptProviders, Resources and Data Sources
Answer

Normally during plan, so its result is available for planning. If an argument depends on a resource not yet created (unknown), Terraform defers the read to apply time and every attribute becomes "known after apply", which can ripple into larger plans. Avoid depending a data source on resources from the same apply when you can.

All Terraform questions Roadmap: Terraform

More on Providers, Resources and Data Sources