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

Upgrade hcl2 to validate arrays for unknown values #5844

Merged
merged 2 commits into from
Jun 19, 2019

Conversation

notnoop
Copy link
Contributor

@notnoop notnoop commented Jun 17, 2019

This upgrades hcl2 library dependency to pick up
hashicorp/hcl2#113 .

Prior to this change, parsing and decoding array attributes containing
invalid errors (e.g. references to unknown variables) are silently
dropped, with cty.Unknown being assigned to the bad element.

Rather than showing a type/meaningful error from hcl2, we get a very cryptic error message from msgpack layer trying to handle cty.unknown. Sometimes, we do get an hcl type validation error back, but it's still cryptic e.g. Incorrect attribute value type; Inappropriate value for attribute "list_field": map of string required without explaining why it's inappropriate.

This ensures that we propagate diagnostics correctly and report
meaningful errors to users.

The tests capture the behavior, you can see the failing tests in https://travis-ci.org/hashicorp/nomad/jobs/546843716 and they pass in the latest commit of this PR: https://travis-ci.org/hashicorp/nomad/jobs/546848034 .

Fixes #5694
Fixes #5680

Mahmood Ali added 2 commits June 17, 2019 12:25
This upgrades hcl2 library dependency to pick up
hashicorp/hcl2#113 .

Prior to this change, parsing and decoding array attributes containing
invalid errors (e.g. references to unknown variables) are silently
dropped, with `cty.Unknown` being assigned to the bad element.  Rather
than showing a type/meaningful error from hcl2, we get a very decrypted
error message from msgpack layer trying to handle `cty.unknown`.

This ensures that we propagate diagnostics correctly and report
meaningful errors to users.

Fixes #5694
Fixes #5680
@notnoop notnoop requested a review from schmichael June 17, 2019 16:56
@notnoop notnoop merged commit e93bbf8 into master Jun 19, 2019
@notnoop notnoop deleted the b-hcl-parse-unknown-vars branch June 19, 2019 14:44
notnoop pushed a commit that referenced this pull request Jun 19, 2019
@github-actions
Copy link

github-actions bot commented Feb 8, 2023

I'm going to lock this pull request because it has been closed for 120 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 Feb 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants