You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting Error: ERROR: Hook 'load_terraform_data' from /usr/local/lib/python3.7/site-packages/terraform_compliance/steps/terrain.py:5 raised: 'TypeError: 'NoneType' object is not iterable'
#275
Closed
MartinLogan opened this issue
May 21, 2020
· 3 comments
Description :
It looks as though when encountering a module output that is just a list it is not seeing it as iterable.
If I move the declaration of the list to a local and then assign the local to the output value it succeeds
Tests added and proposed fix in a draft PR #276 - You can see the failure scenario there.
terraform-compliance -p plan.out.json -f .
Fails with both python and docker container
Error output
mlogan at C02YV0U4LVCF in~/Projects/mlogan/terraform-compliance/tests/functional/test_module_output_list on master [?]
$ terraform-compliance -p plan.out.json -f .
terraform-compliance v1.2.1 initiated
🚩 Features : /target
🚩 Plan File : /target/plan.out.json
🚩 Running tests. 🎉
Feature: The scenarios defined below # /target/security_group.feature
require an MR review if any
of the resources below exist
in a plan
1 features (0 passed)
4 scenarios (0 passed)
8 steps (0 passed)
Run 1590092214 finished within a moment
❗ ERROR: Hook 'load_terraform_data' from /usr/local/lib/python3.7/site-packages/terraform_compliance/steps/terrain.py:5 raised: 'TypeError: 'NoneType' object is not iterable'
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/radish/hookregistry.py", line 132, in call
func(model, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/terraform_compliance/steps/terrain.py", line 7, in load_terraform_data
world.config.terraform = TerraformParser(world.config.user_data['plan_file'])
File "/usr/local/lib/python3.7/site-packages/terraform_compliance/extensions/terraform.py", line 42, in __init__
self.parse()
File "/usr/local/lib/python3.7/site-packages/terraform_compliance/extensions/terraform.py", line 344, in parse
self._mount_references()
File "/usr/local/lib/python3.7/site-packages/terraform_compliance/extensions/terraform.py", line 289, in _mount_references
ref_list[key] = self._find_resource_from_name(ref)
File "/usr/local/lib/python3.7/site-packages/terraform_compliance/extensions/terraform.py", line 259, in _find_resource_from_name
resources = ['{}.{}.{}'.format(resource_type, module_name, res) forresin resources]
TypeError: 'NoneType' object is not iterable
Simple feature failure test - can be anything
Feature: The scenarios defined below
require an MR review if any
of the resources below exist
in a plan
Scenario Outline: changes to specific resourcesGiven I have <resource> defined
Then the scenario should fail
Examples:
| resource | | aws_elasticache_security_group | | aws_default_security_group | | aws_security_group | | aws_security_group_rule |
Expected behavior :
Tested versions :
terraform-compliance version 1.2.1
terraform version 0.12.13
<python runtime version, 3.7.7 (BUt fails from docker as well)
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Description :
It looks as though when encountering a module output that is just a list it is not seeing it as iterable.
If I move the declaration of the list to a local and then assign the local to the output value it succeeds
Tests added and proposed fix in a draft PR #276 - You can see the failure scenario there.
Expected behavior :
Tested versions :
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: