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

command: more resilient HCL check for inputs #8620

Merged
merged 2 commits into from
Sep 2, 2016
Merged

command: more resilient HCL check for inputs #8620

merged 2 commits into from
Sep 2, 2016

Conversation

mitchellh
Copy link
Contributor

Fixes #8044

This introduces a more resilient check when parsing variable values as HCL for determining if they were really HCL or not. Before, we simply checked error message (I kept this around although it may no longer be necessary). Now, I check for certain starting symbols ignoring whitespace:

  • [ - List
  • { - Map
  • " - String

If it DOESN'T have one of those, we return as-is.

Existing tests pass. I want to double check with @jen20 if this is enough.

// matches what we'd expect a rich HCL value to be. For example: {
// definitely signals a map. If a value DOESN'T match this, we return
// it as a raw string.
varFlagHCLRe = regexp.MustCompile(`^["\[\{]`)
Copy link
Contributor

@jen20 jen20 Sep 2, 2016

Choose a reason for hiding this comment

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

I think previously we would have allowed whitespace at the start of the string, so this is somewhat different.

Edit: just saw it compared with strings.TrimSpace, ignore.

@mitchellh mitchellh merged commit fad1ce9 into master Sep 2, 2016
@mitchellh mitchellh deleted the b-var-input branch September 2, 2016 17:02
@ghost
Copy link

ghost commented Apr 22, 2020

I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing value via -var fails
3 participants