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

backends: Fix crash when interrupting during interactive prompt for values' #36448

Merged
merged 3 commits into from
Feb 7, 2025

Conversation

dbanck
Copy link
Member

@dbanck dbanck commented Feb 6, 2025

This PR fixes a crash that affects all remote state backends that implement the backendbase.Base. When interrupting (Ctrl+c) during Terraform's interactive value prompt, we convert the resulting unknown value to a null value.
Our generic PrepareConfig wasn't prepared to handle nulls and crashed when applying the sdk-like defaults.

Fixes #36420

Target Release

1.11.x

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

@dbanck dbanck added the 1.11-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label Feb 6, 2025
@dbanck dbanck requested a review from a team as a code owner February 6, 2025 13:56
Copy link
Member

@SarahFrench SarahFrench left a comment

Choose a reason for hiding this comment

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

This solves the panic that affects the gcs backend in the linked issue, and I believe testing at the level in this PR is appropriate :shipit:

@dbanck dbanck merged commit 6d7f801 into main Feb 7, 2025
9 of 10 checks passed
@dbanck dbanck deleted the dbanck/init-sigint-crash branch February 7, 2025 09:41
fredouric pushed a commit to fredouric/terraform that referenced this pull request Feb 11, 2025
…alues' (hashicorp#36448)

* backends: Convert null values to empty objects before coercion

* backends: add test case for interrupt crash

* Add changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.11-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 crashes with panic: interface conversion: interface {} is nil, not map[string]interface {}
2 participants