-
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
connect references from config nodes during apply #33403
Conversation
@@ -6463,7 +6463,7 @@ func TestContext2Apply_errorCreateInvalidNew(t *testing.T) { | |||
if got, want := diags.Err().Error(), "forced error"; !strings.Contains(got, want) { | |||
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 { |
There was a problem hiding this comment.
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
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.
e320507
to
bb0bb7a
Compare
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
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. |
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 callwriteResourceState
and can be done bynodeExpandApplyableResource
without the expansion (the "Expand" node name in this context refers to the setting of theinstances.Expander
, notDynamicExpand
)Fixes #33370