Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

cmd/hcl2_upgrade: Fix crash when variables block is undefined #12250

Merged
merged 1 commit into from
Feb 8, 2023

Conversation

nywilken
Copy link
Contributor

@nywilken nywilken commented Feb 7, 2023

This change fixes a crash that occurs when trying to add undeclared variables into an empty
variables map. The variables block when defined will always be non-nil but in the case
where variables are declared and initialized from a legacy JSON variables file the map
must be initialized first.

Closes #12199

@nywilken nywilken requested a review from a team as a code owner February 7, 2023 18:26
@nywilken nywilken added this to the 1.8.6 milestone Feb 7, 2023
@nywilken nywilken added bug regression backport/1.8.x Backport PR changes to `release/1.8.x` labels Feb 7, 2023
@nywilken nywilken changed the title Fix crash when variables block is undefined cmd/hcl2_upgrade: Fix crash when variables block is undefined Feb 7, 2023
Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

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

LGTM!

This change fixes a crash that occurs when trying to add undeclared variables into an empty
variables map. The variables block when defined will always be non-nil but in the case
where variables are declared and initialized from a legacy JSON variables file the map
must be initialized first.
@nywilken nywilken force-pushed the nywilken/hcl2upgrade-variables-empty-map branch from c197c74 to 6c9e653 Compare February 8, 2023 16:21
@nywilken nywilken merged commit 095959e into main Feb 8, 2023
@nywilken nywilken deleted the nywilken/hcl2upgrade-variables-empty-map branch February 8, 2023 18:40
@github-actions
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 issues.
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 11, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
backport/1.8.x Backport PR changes to `release/1.8.x` bug regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

packer hcl2_upgrade crashing
2 participants