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

hcl2: don't show an empty source on var errors #12712

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

lbajolet-hashicorp
Copy link
Contributor

If a variable is defined and overriden in the packer command-line, but there's a problem during the evaluation of this override (type error typically), we show an error message which details the problem.

This message points to a temporary in-memory HCL2 "file" that we use for parsing and evaluating the expression for the variable, but since it's virtual, there's no point in using this as the source for the error, as it will always yield "line 0" and no contents.

So, in order to limit confusion here, we remove the source for this error message.

If a variable is defined and overriden in the packer command-line, but
there's a problem during the evaluation of this override (type error
typically), we show an error message which details the problem.

This message points to a temporary in-memory HCL2 "file" that we use for
parsing and evaluating the expression for the variable, but since it's
virtual, there's no point in using this as the source for the error, as
it will always yield "line 0" and no contents.

So, in order to limit confusion here, we remove the source for this
error message.
@lbajolet-hashicorp lbajolet-hashicorp marked this pull request as ready for review November 27, 2023 21:41
@lbajolet-hashicorp lbajolet-hashicorp requested a review from a team as a code owner November 27, 2023 21:41
@nywilken nywilken added backport/1.10.x Backport PR changes to `release/1.10.x` hcl2 labels Nov 28, 2023
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

Nice catch 👍

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 Dec 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/1.10.x Backport PR changes to `release/1.10.x` hcl2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants