Skip to content
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

delay data source reads with pending resource ref #26284

Merged
merged 1 commit into from
Sep 21, 2020

Conversation

jbardin
Copy link
Member

@jbardin jbardin commented Sep 17, 2020

Treat any reference from a data source to a managed resource as a
dependency on the entire resource. While a resource's
attribute may be statically resolvable from the configuration, if the
user added a reference to that resource, it stands to reason that the
user intended there to be a dependency which we need to wait on.

This is an extension of an implicit behavior that existed previously in
Terraform, but was lost in the 0.13 release. That behavior was emergent
from the fact that the Refresh walk did not process the configuration
for managed resources, so any new resources in the config would be
evaluated as entirely unknown during Refresh, even if some attributes
were statically resolvable at that point.

This new implementation restores the old behavior, and extends it to
updates and replacements of the referenced resource. What this does
not add is waiting on transitive dependencies of the referenced
resources. Because the data sources will wait for any changes to the
resources as well, we want to limit the scope to the resources explicitly
listed in the configuration.

Fixes #25961

@jbardin jbardin requested a review from a team September 17, 2020 20:51
@codecov
Copy link

codecov bot commented Sep 17, 2020

Codecov Report

Merging #26284 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted Files Coverage Δ
terraform/transform_reference.go 90.78% <100.00%> (+0.39%) ⬆️
states/statefile/version4.go 55.45% <0.00%> (+0.30%) ⬆️
dag/marshal.go 54.79% <0.00%> (+1.36%) ⬆️

Treat any reference from a data source to a managed resource as a
dependency on the entire resource. While a resource's
attribute may be statically resolvable from the configuration, if the
user added a reference to that resource, it stands to reason that the
user intended there to be a dependency which we need to wait on.

This is an extension of an implicit behavior that existed previously in
Terraform, but was lost in the 0.13 release. That behavior was emergent
from the fact that the Refresh walk did not process the configuration
for managed resources, so any new resources in the config would be
evaluate as entirely unknown during Refresh, even if some attributes
were statically resolvable at that point.

This new implementation restores the old behavior, and extends it to
updates and replacements of the referenced resource.
@jbardin jbardin force-pushed the jbardin/data-resource-reference branch from 2062ab4 to 8b31808 Compare September 18, 2020 13:11
@jbardin jbardin merged commit abf30de into master Sep 21, 2020
@ghost
Copy link

ghost commented Oct 22, 2020

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 ghost locked as resolved and limited conversation to collaborators Oct 22, 2020
@jbardin jbardin deleted the jbardin/data-resource-reference branch November 20, 2020 20:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implicit Reference Ordering with Data Sources in 0.13
2 participants