Support long terraform variable names in ErrMissingVar #110
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
An issue currently exists when a terraform variable with a very long name has no value. In these cases, the error message returned from tfexec/errors.go doesn't include the name of the terraform variable that is causing the problem. This is because terraform attempts to make error messages fit the terminal width, which means error messages can have a newline character instead of a space depending on the length of the variable name, and therefore the error message regex in terraform-exec doesn't match properly. This PR fixes this behavior to correctly display error messages no matter the length of the terraform variable name by matching on "\s" instead of " ".
This issue doesn't appear to be a problem with the Terraform 0.11 regex because of how much shorter the error message is.
To illustrate the problem, you can see the output when running the e2etest added in this PR without the fix to the regex in errors.go being in place: