mattray / inspec-iggy

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

should eq vs should cmp #23

Closed asimonrose closed 5 years ago

asimonrose commented 5 years ago

Hi,

I'm running Inspec 3.7.11 with Iggy 0.4.0 against AWS resources and a local terraform(0.11.11) state file. I've found that the Inspec Iggy control file generated has 'should eq' for resources where that's needed. However, running that file has a lot of failures. If I just change that too 'should cmp' then virtually all the tests pass.

Is this a 'feature' of this version of Inspec 3.0 and this version of Iggy? Is this is problem?

Apologies, I'm really new to Inspec and Iggy, so I'm not sure what the 'right' behaviour should be. Maybe 'should eq' is better than 'should cmp' and I'm missing trick?

Simon

asimonrose commented 5 years ago

In order to resolve this particular issue for me, I changed the file:

.inspec/gems/2.5.0/gems/inspec-iggy-0.4.0/lib/inspec-iggy/terraform/parser.rb

changing the entry from:

describe.add_test(attr, 'eq', value)

to

describe.add_test(attr, 'cmp', value)

Now I'm just left with the aws_route_table issue.

mattray commented 5 years ago

Thanks! The 'eq' is probably overly picky, I'll switch to 'cmp'. I'll include this update in the upcoming 0.5.0 release.