mattray / inspec-iggy

InSpec CLI plugin for generating compliance controls from Terraform and CloudFormation
Apache License 2.0
106 stars 18 forks source link

undefined method `each' for nil:NilClass (NoMethodError) - Terraform 11.14 #35

Closed gavinmoorcroft closed 4 years ago

gavinmoorcroft commented 4 years ago

Describe the bug When we try to execute the plugin against a 11.14 state file we get the following error:

Traceback (most recent call last):
    15: from /usr/local/bundle/bin/inspec:23:in `<main>'
    14: from /usr/local/bundle/bin/inspec:23:in `load'
    13: from /usr/local/bundle/gems/inspec-bin-4.18.61/bin/inspec:11:in `<top (required)>'
    12: from /usr/local/bundle/gems/inspec-4.18.61/lib/inspec/base_cli.rb:35:in `start'
    11: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
    10: from /usr/local/bundle/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
     9: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
     8: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
     7: from /usr/local/bundle/gems/thor-1.0.1/lib/thor.rb:243:in `block in subcommand'
     6: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/invocation.rb:116:in `invoke'
     5: from /usr/local/bundle/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
     4: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
     3: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
     2: from /root/.inspec/gems/2.7.0/gems/inspec-iggy-0.7.0/lib/inspec-iggy/terraform/cli_command.rb:81:in `generate'
     1: from /root/.inspec/gems/2.7.0/gems/inspec-iggy-0.7.0/lib/inspec-iggy/terraform/generate.rb:20:in `parse_generate'
/root/.inspec/gems/2.7.0/gems/inspec-iggy-0.7.0/lib/inspec-iggy/terraform/generate.rb:34:in `parse_resources': undefined method `each' for nil:NilClass (NoMethodError)

I understand the plugin has just been update to work with Terraform 12. we are on TF 11.14 and aren't able to update to 12 at this time.

Is there any plans to fix this backwards compatibility?

If now, what version should we be looking at to use it with TF 11.14??

Thanks!

Environment Inspec: 4.18.61 (we are using the Inspec docker image) Terrafom: 11.14 InSpec-Iggy: 8

To Reproduce inspec terraform generate --tfstate terraform.tfstate --name test_profile --platform aws --resourcepath /tmp/inspec-aws

Expected behavior We expected it to generate controls for th

mattray commented 4 years ago

Unfortunately I don't have the time and capacity to continue to support Terraform 0.11.