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

lang/funcs: templatefile requires valid variable names #24184

Merged
merged 2 commits into from
Feb 25, 2020

Commits on Feb 22, 2020

  1. lang/funcs: Test actual error messages from templatefile

    This function has a number of different error cases with hopefully-helpful
    error messages for each, so it's good to test we're getting the error
    message we were actually expecting in each case.
    apparentlymart committed Feb 22, 2020
    Configuration menu
    Copy the full SHA
    d0f7434 View commit details
    Browse the repository at this point in the history
  2. lang/funcs: templatefile requires valid variable names

    Previously the templatefile function would permit any arbitrary string as
    a variable name, but due to the HCL template syntax it would be impossible
    to refer to one that isn't a valid HCL identifier without causing an
    HCL syntax error.
    
    The HCL syntax errors are correct, but don't really point to the root
    cause of the problem. Instead, we'll pre-verify that the variable names
    are valid before we even try to render the template, and given a
    specialized error message that refers to the vars argument expression as
    the problematic part, which will hopefully make the resolution path
    clearer for a user encountering this situation.
    
    The syntax error still remains for situations where all of the variable
    names are correct but e.g. the user made a typo referring to one, which
    makes sense because in that case the problem _is_ inside the template.
    apparentlymart committed Feb 22, 2020
    Configuration menu
    Copy the full SHA
    0788000 View commit details
    Browse the repository at this point in the history