inspec / inspec-gcp

InSpec GCP (Google Cloud Platform) Resource Pack
https://www.inspec.io/
Other
148 stars 74 forks source link

inspec-gcp : failure when using gem nori:2.7.0 #596

Open vedisquori opened 5 months ago

vedisquori commented 5 months ago

Hi, i'm a bit new to inspec and inspec-gcp but there is what I found From two days ago, there was a new release of gem nori 2.7.0, something changed the default behavior of inspec-gcp.

Describe the problem

When launching bundle exec kitchen verify, there is an error which says : undefined method '[]' for nil:NilClass I tried directly with bundle exec inspec exec . -t gcp:// same thing, but it goes a bit deeper into the error : Input 'my_input' does not have a value. Skipping test.libraries/google_compute_target_http_proxy.rb:56:in 'to_s': undefined method `[]' for nil:NilClass (NoMethodError)

When forcing nori:2.6.0 in gemfile, all goes according to plan, no error and inspec-gcp works well.

Possible Solution

Forcing usage of nori:2.6.0 or wait for a fix in next nori version ?

brettcurtis commented 4 months ago

I'm seeing this specifically on the following resource with the most basic tests:

control 'service_account' do
  title 'Service Account'

  # Service Account Resource
  # https://www.inspec.io/docs/reference/resources/google_service_account

  describe google_service_account(project: 'my-project-tf40dbd6-sb', name: 'foo-k8s-wif@my-project-tf40dbd6-sb.iam.gserviceaccount.com' ) do
    it { should exist }
  end
end

Other resource like google_service_account_keys and google_project_iam_binding work fine.

Adding nori:2.6.0 to my Gemfile helped me W/A the problem. Thanks!