How does `depends_on` affect data sources?
AdvancedConceptLifecycle, Dependencies, Provisioners and Drift
Answer
A data source with depends_on cannot be read at plan time if the target has pending changes, so its read is deferred to apply and its attributes become unknown, causing wider downstream diffs. This is why we prefer referencing an attribute from the dependency in the data source's arguments rather than using depends_on.
More on Lifecycle, Dependencies, Provisioners and Drift
What are meta-arguments?BeginnerWhat lifecycle options are available?BeginnerHow does `create_before_destroy` work and what can go wrong?AdvancedWhat does `prevent_destroy` guarantee and what does it not?AdvancedWhen do you use `ignore_changes`?IntermediateWhat does `replace_triggered_by` do?Advanced