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

No HCL object could be decoded #80

Closed
zachzeid opened this issue Aug 29, 2018 · 1 comment
Closed

No HCL object could be decoded #80

zachzeid opened this issue Aug 29, 2018 · 1 comment

Comments

@zachzeid
Copy link
Contributor

  • terrascan version: 0.1.0 (development mode)
  • Python version: 3.6.1
  • Operating System: OS X 10.13.6

Description

Trying to run tests against terraform templates with terrascan set up in development

What I Did

terrascan -l . -t all

This is one of many similar tracebacks

ERROR: test_aws_security_group_rule_open (terrascan.checks.security_group.TestSecurityGroups)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/zachary.zeid/github/terrascan/terrascan/.eggs/terraform_validate-2.5.0-py3.6.egg/terraform_validate/terraform_validate.py", line 464, in parse_terraform_directory
    hcl.loads(new_terraform)
  File "/Users/zachary.zeid/github/terrascan/terrascan/.eggs/pyhcl-0.3.10-py3.6.egg/hcl/api.py", line 61, in loads
    if isHcl(s):
  File "/Users/zachary.zeid/github/terrascan/terrascan/.eggs/pyhcl-0.3.10-py3.6.egg/hcl/api.py", line 39, in isHcl
    raise ValueError("No HCL object could be decoded")
ValueError: No HCL object could be decoded

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/zachary.zeid/github/terrascan/terrascan/terrascan/checks/security_group.py", line 21, in setUp
    self.v = terraform_validate.Validator(self.path)
  File "/Users/zachary.zeid/github/terrascan/terrascan/.eggs/terraform_validate-2.5.0-py3.6.egg/terraform_validate/terraform_validate.py", line 431, in __init__
    self.terraform_config = self.parse_terraform_directory(path)
  File "/Users/zachary.zeid/github/terrascan/terrascan/.eggs/terraform_validate-2.5.0-py3.6.egg/terraform_validate/terraform_validate.py", line 466, in parse_terraform_directory
    raise TerraformSyntaxException("Invalid terraform configuration in {0}\n{1}".format(os.path.join(directory,file),e))
terraform_validate.terraform_validate.TerraformSyntaxException: Invalid terraform configuration in /Users/zachary.zeid/github/terrascan/terrascan/variables.tf
No HCL object could be decoded

----------------------------------------------------------------------
Ran 5 tests in 0.036s

FAILED (errors=5)  ```
@zachzeid
Copy link
Contributor Author

I found the resolution to this issue, as my variables.tf file was empty. However, this error needs to have better error handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant