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: Hook 'load_terraform_data' #124

Closed
anthonycolon25 opened this issue Jul 12, 2019 · 8 comments
Closed

Error: Hook 'load_terraform_data' #124

anthonycolon25 opened this issue Jul 12, 2019 · 8 comments
Assignees
Labels
bug fixing A fix is addressed, no further data is required waiting for confirmation Workaround/Fix applied, waiting for confirmation

Comments

@anthonycolon25
Copy link

Hi,

I am have expand my terraform to now use modules (which have some interpolation as well). It seems to fail very qucikly while tying to load the plan output json.

I am using v1.0.13 and terraform 0.12.3

Here is the error:

$ terraform-compliance -p /target/tc-test2/tf-template/jenkins.plan.out.json -f /target/tc-test2/features
terraform-compliance v1.0.13 initiated

* Features  : /target/tc-test2/features
* Plan File : /target/tc-test2/tf-template/jenkins.plan.out.json

. Running tests.
Feature: Resources should be properly tagged  # /target/tc-test2/features/tags.feature
    In order to keep track of resource ownership
    As engineers
    We'll enforce tagging on all resources
2 features (0 passed)
30 scenarios (0 passed)
109 steps (0 passed)
Run 1562934682 finished within a moment
Error: Hook 'load_terraform_data' from /usr/local/lib/python3.7/site-packages/terraform_compliance/steps/terrain.py:5 raised: 'KeyError: 'values''

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 34, in __init__
    self.parse()
  File "/usr/local/lib/python3.7/site-packages/terraform_compliance/extensions/terraform.py", line 225, in parse
    self._mount_references()
  File "/usr/local/lib/python3.7/site-packages/terraform_compliance/extensions/terraform.py", line 200, in _mount_references
    self._mount_resources(source_resources, flatten_list(ref_list), ref_type)
  File "/usr/local/lib/python3.7/site-packages/terraform_compliance/extensions/terraform.py", line 153, in _mount_resources
    self.resources[target_resource]['values'][ref_type].append(self.resources[source_resource]['values'])
KeyError: 'values'

Any ideas?

@anthonycolon25
Copy link
Author

Same error after upgrading to v1.0.20 docker image

@eerkunt
Copy link
Member

eerkunt commented Jul 12, 2019

Hi,

Thanks for the issue! Hard to understand by this.

Is it possible to share that jenkins.plan.out.json (assuming you dont have anything confidential) and your feature file for reproducing the problem ?

Thanks!

@himanshuvaish
Copy link

I am also having same issue.

@anthonycolon25
Copy link
Author

I can try trimming down the feature file for anything that might be confidential. The jenkins.plan.out.json is pretty big and has a lot of confidential information. I don't think I can share that one.

@eerkunt
Copy link
Member

eerkunt commented Jul 16, 2019

No worries, will work on this asap.

@eerkunt eerkunt self-assigned this Jul 16, 2019
@eerkunt eerkunt added bug fixing A fix is addressed, no further data is required labels Jul 16, 2019
eerkunt added a commit that referenced this issue Jul 16, 2019
@eerkunt
Copy link
Member

eerkunt commented Jul 16, 2019

Fix has been introduced in 1.0.22.

Can you please have a try ? Build is started, must be there in few minutes.

@eerkunt eerkunt added the waiting for confirmation Workaround/Fix applied, waiting for confirmation label Jul 16, 2019
@anthonycolon25
Copy link
Author

I have tested with my more complex terraform script and no longer get the errors using v1.0.22

@eerkunt
Copy link
Member

eerkunt commented Jul 16, 2019

Thanks for testing. 🎉
Closing this issue.

@eerkunt eerkunt closed this as completed Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fixing A fix is addressed, no further data is required waiting for confirmation Workaround/Fix applied, waiting for confirmation
Projects
None yet
Development

No branches or pull requests

3 participants