-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defer data source reads with output depends_on #30782
Comments
Hi @bharathkkb, The data source will be deferred until apply under 2 circumstances: if the configuration for the data source contains an unknown value, or the data source uses It's generally recommended to not have a managed resource and a data source represent the same logical resource within the same configuration to avoid these types of issues. When that situation is unavoidable, the correct solution is to use The behavior in 0.12 was incorrect in many cases, but prior to v0.14 data source evaluation was basically a "best effort" attempt, because it happened during a separate refresh phase where there was incomplete information to determine what could and couldn't be read. Now that data source evaluation happens during plan, the results have been made consistent. We use GitHub issues for tracking bugs and enhancements, rather than for questions. While we can sometimes help with certain simple problems here, it's better to use the community forum where there are more people ready to help. Thanks! |
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. |
Terraform Version
Terraform Configuration Files
Debug Output
Expected Behavior
data "google_storage_bucket_object" "output"
read should have been deferred to apply time as it needsmodule.inner.op
which has a dependency ongoogle_storage_bucket_object.create
.Adding an explicit module dependency as mentioned below should not be necessary if the output has explicit dependency.
It also looks like this worked as expected in
0.12.31
but is not working for subsequent versions.Actual Behavior
Datasource read is not deferred to apply time resulting in a 404
Adding an explicit dependency like
does defer the read to apply time
Steps to Reproduce
Additional Context
The example is contrived and created for simplicity. terraform-google-modules/terraform-google-kubernetes-engine#1181 and trying to fix it via terraform-google-modules/terraform-google-kubernetes-engine#1189 (comment) was the reason behind this issue.
References
The text was updated successfully, but these errors were encountered: