Conversation
Codecov Report
|
terraform/eval_read_data_plan.go
Outdated
| for _, d := range n.dependsOn { | ||
| if d.Resource.Mode == addrs.DataResourceMode { | ||
| // Data sources have no side effects, so don't create a need to | ||
| // delay this read. If the they do have a change planned, it must |
There was a problem hiding this comment.
| // delay this read. If the they do have a change planned, it must | |
| // delay this read. If they do have a change planned, it must |
typo!
A data source referencing another data source through depends_on should not be forced to defer until apply. Data sources have no side effects, so nothing should need to be applied. If the dependency has a planned change due to a managed resource, the original data source will also encounter that further down the list of dependencies. This prevents a data source being read during plan for any reason from causing other data sources to be deferred until apply. It does not change the behavior noticeably in 0.14, but because 0.13 still had separate refresh and plan phases which could read the data source, the deferral could cause many things downstream to become unexpectedly unknown until apply.
e3a4e91 to
ea9096f
Compare
|
for me 0.13.4 half resolved it for me reading your description I did some experiments. I have module a and module b with many data 'aws_iam_policy_document' resources, created in for_each loops. When I originally created this in 0.13.2, every time I planned (irrelevant of what code I was changing). I was getting a diff for all of them, looking like this: You can see my original post on what I was experiencing here: https://discuss.hashicorp.com/t/data-aws-iam-policy-document-and-for-each-showing-changes-on-every-plan-and-nothing-on-apply/14606 when I upgraded to 0.13.4 we noticed that it disappeared but then would come back sometimes. I identified that it only came back when we made a change in module a which seemed odd because it is completely unrelated but then I noticed that there was a dependency on module b for module a. I thought about this for a moment and decided it wasn't necessary. Now everything seems resolved, but maybe still a terraform bug here. if I make changes in module a, I do not get the diffs (as shown above) for all of the data source aws_iam_policy_documents that are created and maintained in module b but only after removing the depends_on key for module a, on module b. 👍 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. 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. |
A data source referencing another data source through depends_on should
not be forced to defer until apply. Data sources have no side effects,
so nothing should need to be applied. If the dependency has a
planned change due to a managed resource, the original data source will
also encounter that further down the list of dependencies.
This prevents a data source being read during plan for any reason from
causing other data sources to be deferred until apply. It does not
change the behavior noticeably in 0.14, but because 0.13 still had
separate refresh and plan phases which could read the data source, the
deferral could cause many things downstream to become unexpectedly
unknown until apply.