-
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
depends_on for data_source #10603
Comments
Hi @samber. Sorry for the issue here. I think I remember seeing this issue on here before but I couldn't find it quickly. IIRC the problem here is that Terraform uses computed attributes to decide whether to defer a data source from refresh time to apply time, but an explicit You're right that this is a bug, but for now I would suggest working around it by adding a "dummy interpolation" to your data resource so that Terraform knows it must defer loading it, if possible. This means finding a computed attribute from the resource to interpolate somewhere into the data resource. I assume your example here is just a contrived repro case, but there's usually something you can interpolate to force Terraform to do the right thing here. The real fix in the long run would be for the code that decides whether to defer a data source to also check the explicit |
Ok, thanks for your fast reply. We will find a work around with a faked computed attribute call. |
I think we can get by with the simpler solution here, and just check for The only issue I can think of with this, is somehow breaking a config where |
Prevent data sources from being aplied early
this addes the ability to search for EIP’s via tags or other attribute that EIP’s can use in a filter. This did highlight a known issue with regrads to how terraform eval’s data sources before they should if be the resourse is a computed value. This is only an issue if the data block is referencing a resource that is created at the same time. If referencing a pre exiting resource this does not happen. the test config testAccDataSourceAwsEipFilterConfig makes a interpol ref to force terraform to eval the data block after the resource has either been created or read in `values = ["${aws_eip.test.tags.Name}”]` see the following links hashicorp/terraform#10603 hashicorp/terraform#17173
I am facing same issue on latest version
Basic Terraform Code
If |
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. |
Hi guys,
I am using the depends_on parameter on data-source.
It needs to be applied 2 times to get the right output.
The text was updated successfully, but these errors were encountered: