Skip to content

core: Don't re-register checkable outputs during the apply step#31890

Merged
apparentlymart merged 1 commit intomainfrom
b-check-output-multi-expand
Sep 29, 2022
Merged

core: Don't re-register checkable outputs during the apply step#31890
apparentlymart merged 1 commit intomainfrom
b-check-output-multi-expand

Conversation

@apparentlymart
Copy link
Copy Markdown
Contributor

Once again we're caught out by sharing the same output value node type between the plan phase and the apply phase. To allow for some slight variation between plan and apply without drastic refactoring here we just add a new flag to nodeExpandOutput which is true only during the planning phase.

This then allows us to register the checkable objects only during the planning phase and not incorrectly re-register them during the apply phase. It's incorrect to re-register during apply because we carry over the planned checkable objects from the plan phase into the apply phase so we can guarantee that the final state will have all of the same checkable objects that the plan did.

This avoids a panic during the apply phase from the incorrect duplicate registration. This closes #31846.

@apparentlymart apparentlymart added the 1.3-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label Sep 28, 2022
@apparentlymart apparentlymart requested a review from a team September 28, 2022 17:52
@apparentlymart apparentlymart self-assigned this Sep 28, 2022
@apparentlymart apparentlymart marked this pull request as draft September 28, 2022 18:00
Once again we're caught out by sharing the same output value node type
between the plan phase and the apply phase. To allow for some slight
variation between plan and apply without drastic refactoring here we just
add a new flag to nodeExpandOutput which is true only during the planning
phase.

This then allows us to register the checkable objects only during the
planning phase and not incorrectly re-register them during the apply phase.
It's incorrect to re-register during apply because we carry over the
planned checkable objects from the plan phase into the apply phase so we
can guarantee that the final state will have all of the same checkable
objects that the plan did.

This avoids a panic during the apply phase from the incorrect duplicate
registration.
@apparentlymart apparentlymart force-pushed the b-check-output-multi-expand branch from c1886a2 to e28b1c8 Compare September 28, 2022 18:29
@apparentlymart apparentlymart marked this pull request as ready for review September 28, 2022 18:54
@apparentlymart apparentlymart merged commit 6b290cf into main Sep 29, 2022
@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 Oct 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

1.3-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"panic: duplicate checkable objects report" in terraform apply

2 participants