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

Fix crash when nested data blocks are mixed with the import command #33578

Merged
merged 1 commit into from Jul 26, 2023

Conversation

liamcervante
Copy link
Member

This PR fixes a crash that occurs when the terraform import command is used against configuration that has a nested data block defined within a check block.

Essentially, the nested data block still tries to report its checkable status during an import operation. This results in the checks system panicking as it is not expecting that kind of check to be reported.

The fix in this case is just to make the full check block also execute during an import operation. Note, that this behaviour matches the behaviour of other checkable objects. Resource pre and post conditions still execute during the validate operation, they just report warnings instead of errors. As check blocks already only report warnings, making all checkable objects consistent in this case is as simple as turning on check blocks during import.

Fixes #33572

Target Release

1.5.4

Draft CHANGELOG entry

BUG FIXES

  • check blocks: Fixes crash when nested data sources are within configuration targeted by the terraform import command.
  • check blocks: Check blocks now operate in line with other checkable objects by also executing during import operations.

@liamcervante liamcervante added the 1.5-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label Jul 25, 2023
@liamcervante liamcervante requested a review from a team July 25, 2023 14:44
Copy link
Member

@apparentlymart apparentlymart left a comment

Choose a reason for hiding this comment

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

This sort of direct checking of the walk type does unfortunately tend to cause hazards like this under future maintenance. 😖

Hopefully in future we can find a more general way to solve this that doesn't require individually enumerating a specific subset of the walk types, but this seems like a good tactical fix for the immediate bug, and a good tradeoff for backporting.

@liamcervante liamcervante merged commit dff447b into main Jul 26, 2023
6 checks passed
@liamcervante liamcervante deleted the liamcervante/33572 branch July 26, 2023 07:41
@github-actions
Copy link

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

Copy link

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 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.5-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.

Terraform crash during import with check defined
2 participants