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

Error in test_aws_security_group_inline_rule_open and test_aws_security_group_rule_open #138

Closed
brjlpz opened this issue Mar 19, 2019 · 2 comments

Comments

@brjlpz
Copy link

brjlpz commented Mar 19, 2019

  • terrascan version: 0.1.0
  • Python version: Python 3.5.3
  • Operating System: Debian 9

Description

I get errors with the security group tests.

sample tf:

resource "aws_security_group_rule" "integration_allow_ssh_from_bastion" {
  security_group_id        = "${aws_security_group.integration.id}"
  source_security_group_id = "${aws_security_group.bastion.id}"
  from_port                = 22
  to_port                  = 22
  protocol                 = "tcp"
  protocol                 = -1
  type                     = "ingress"
}

What I Did

terrascan --location . --tests all
...
Running security_group Tests
...EE
======================================================================
ERROR: test_aws_security_group_inline_rule_open (terrascan.checks.security_group.TestSecurityGroups)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/blopez/.local/lib/python3.5/site-packages/terrascan/checks/security_group.py", line 52, in test_aws_security_group_inline_rule_open
    'cidr_blocks').list_should_not_contain('0.0.0.0/0')
  File "/home/blopez/.local/lib/python3.5/site-packages/terraform_validate/terraform_validate.py", line 80, in property
    if property_name in property.property_value.keys():
AttributeError: 'list' object has no attribute 'keys'

======================================================================
ERROR: test_aws_security_group_rule_open (terrascan.checks.security_group.TestSecurityGroups)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/blopez/.local/lib/python3.5/site-packages/terrascan/checks/security_group.py", line 44, in test_aws_security_group_rule_open
    'cidr_blocks').list_should_not_contain('0.0.0.0/0')
  File "/home/blopez/.local/lib/python3.5/site-packages/terraform_validate/terraform_validate.py", line 167, in list_should_not_contain
    actual_property_value = self.validator.substitute_variable_values_in_string(property.property_value)
  File "/home/blopez/.local/lib/python3.5/site-packages/terraform_validate/terraform_validate.py", line 504, in substitute_variable_values_in_string
    variable_default_value = self.get_terraform_variable_value(a.variable)
  File "/home/blopez/.local/lib/python3.5/site-packages/terraform_validate/terraform_validate.py", line 493, in get_terraform_variable_value
    raise TerraformVariableException("There is no Terraform variable '{0}'".format(variable))
terraform_validate.terraform_validate.TerraformVariableException: There is no Terraform variable ''

----------------------------------------------------------------------
@alexppg
Copy link

alexppg commented Mar 19, 2019

Also, when executing all the tests, the error code is 0, even when failing. When executing only the security_group test and fails, works as expected and returns 1.

@cesar-rodriguez
Copy link
Contributor

This should be fixed as of Terrascan v1.0.0

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

3 participants