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.
More on Providers, Resources and Data Sources
What is a resource block and how is it addressed?BeginnerWhat is the difference between a resource and a data source?BeginnerHow do you configure a provider such as AWS?BeginnerHow do you use the same provider with multiple regions or accounts?IntermediateIn what order does the AWS provider look for credentials?IntermediateWhat does `default_tags` in the AWS provider do and what are its pitfalls?Intermediate