Skip to content

connect references from config nodes during apply#33403

Merged
jbardin merged 2 commits intomainfrom
jbardin/deps-with-no-instances
Jun 28, 2023
Merged

connect references from config nodes during apply#33403
jbardin merged 2 commits intomainfrom
jbardin/deps-with-no-instances

Conversation

@jbardin
Copy link
Copy Markdown
Member

@jbardin jbardin commented Jun 20, 2023

In order to ensure that transitive dependencies are connected even when there are no instances for a resource, we need to route the references through the config ("expand") node. This happens naturally by having the expand node report its config references, however legacy configs can contain self-references without the "self" identifier, so those need to be filtered out.

We can also remove the old NodeApplyableResource type, which was only there to call writeResourceState and can be done by nodeExpandApplyableResource without the expansion (the "Expand" node name in this context refers to the setting of the instances.Expander, not DynamicExpand)

Fixes #33370

@jbardin jbardin requested a review from a team June 20, 2023 20:40
t.Errorf("returned error does not contain %q, but it should\n%s", want, diags.Err())
}
if got, want := len(state.RootModule().Resources), 2; got != want {
if got, want := len(state.RootModule().Resources), 1; got != want {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is because there is no empty resource record in state now that the expand node is part of the instance ordering

jbardin added 2 commits June 28, 2023 13:31
In order to ensure that transitive dependencies are connected even when
there are no instances for a resource, we need to route the references
through the config ("expand") node. This happens naturally by having the
expand node report its config references, however legacy configs can
contain self-referenced without the "self" identifier, so those need to
be filtered out.
Move the logic for NodeApplyableResource into
nodeExpandApplyableResource to remove an unnecessary level of expansion.
@jbardin jbardin force-pushed the jbardin/deps-with-no-instances branch from e320507 to bb0bb7a Compare June 28, 2023 17:32
@jbardin jbardin merged commit 3fcf16f into main Jun 28, 2023
@jbardin jbardin deleted the jbardin/deps-with-no-instances branch June 28, 2023 18:00
@github-actions
Copy link
Copy Markdown
Contributor

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

@github-actions
Copy link
Copy Markdown
Contributor

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 14, 2023
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.

transitive dependencies can be missed when there are no instances to apply

3 participants