Skip to content

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

Merged
dbanck merged 3 commits intomainfrom
dbanck/init-sigint-crash
Feb 7, 2025
Merged

backends: Fix crash when interrupting during interactive prompt for values'#36448
dbanck merged 3 commits intomainfrom
dbanck/init-sigint-crash

Conversation

@dbanck
Copy link
Copy Markdown
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
Copy Markdown
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
@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
@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 Mar 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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