You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The upstream resource should not detect changes since the data source has not changed.
Actual Behavior
The upstream resource is reprovisioned because it thinks the data source has changed (even though it hasn't).
Steps to Reproduce
touch file.txt
terraform apply -auto-approve
terraform plan (see changes)
Additional Context
I expect data sources to be read each iteration, but if the contents of the data source haven't changed, dependent resources should remain as-is. Also, removing the depends_on clause from the local_file resource in this example stops the issue.
The text was updated successfully, but these errors were encountered:
This is describing the same problem as #11806, so I'm going to close this to consolidate the discussion over there.
The summary is that depends_on is not currently compatible with reasonable use of data resources because it forces the data source to always be read during the apply phase, not during the plan phase. Because Terraform doesn't yet know that the values haven't changed during planning, it must conservatively assume that they will change when it plans changes elsewhere.
For now, the answer is unfortunately to never use depends_on with data resources. Implicit dependencies via references work as expected because Terraform can see that the referenced values haven't changed, but depends_on doesn't give enough information for Terraform to determine what aspect of null_resource.dep is the dependency in order to verify that it hasn't changed.
There's some discussion in the other issue (linking to #17034, the latest proposal) about how this situation might improve in future, with a combination of changing some of the underlying assumptions and also removing refresh as a workflow step separate from planning so that there is more information available when deciding how to handle depends_on.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
ghost
locked and limited conversation to collaborators
Mar 29, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Terraform Version
Terraform Configuration Files
Debug Output
Expected Behavior
The upstream resource should not detect changes since the data source has not changed.
Actual Behavior
The upstream resource is reprovisioned because it thinks the data source has changed (even though it hasn't).
Steps to Reproduce
touch file.txt
terraform apply -auto-approve
terraform plan
(see changes)Additional Context
I expect data sources to be read each iteration, but if the contents of the data source haven't changed, dependent resources should remain as-is. Also, removing the
depends_on
clause from thelocal_file
resource in this example stops the issue.The text was updated successfully, but these errors were encountered: