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

Fix HCL2 panics when parsing undefined variables #10326

Merged
merged 3 commits into from
Apr 8, 2021

Commits on Apr 7, 2021

  1. hcl2: add failing tests

    Mahmood Ali committed Apr 7, 2021
    Configuration menu
    Copy the full SHA
    b500bdb View commit details
    Browse the repository at this point in the history
  2. update hcl2 to latest

    Mahmood Ali committed Apr 7, 2021
    Configuration menu
    Copy the full SHA
    e488493 View commit details
    Browse the repository at this point in the history
  3. hcl2: Use the actual string snippet as it appears from undefined

    With the updated undefined variable code, we attempt to pick the text of
    `${....}` verbatim from the hcl body. Previously, we'd attempt to
    regenerate the string from the AST and pray it matches input; the
    generation is lossy, as the same AST can represent multiple variations
    (e.g. `${v.0}` and `${v[0]}` have the same HCLv2 AST). In this change,
    we attempt to go back to the hcl2 source and find the string snippet
    corresponding to the variable reference.
    Mahmood Ali committed Apr 7, 2021
    Configuration menu
    Copy the full SHA
    f4b62ea View commit details
    Browse the repository at this point in the history