Skip to content

undefined method google_project_iam_binding #420

Closed
@levid0s

Description

@levid0s

Latest version of the plugin can't seem to find this resource, although the documentation is referencing it.

Ruby code:

title "Sample Section"

gcp_project_id = input("gcp_project_id")

control "gcp-test-iam-1.0" do
  impact 1.0
  title "Test roles/compute.imageUser IAM."
  describe google_project_iam_binding(project: backery_gcp_project_id, role: "roles/editor") do
    it { should exist }
    its('members') { should include 'user:some-user@some-gcp-project.iam.gserviceaccount.com' }
  end
end

Error:

C:\temp\inspec-test\my-profile>inspec exec . -t gcp:// --input-file inputs.yml

Profile:   GCP InSpec Profile (my-profile)
Version:   0.1.0
Target:    gcp://764086051811-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com
Target ID: 8f58cc11-1c37-5ad5-b7ce-950b9375e19f

  [FAIL]  gcp-test-iam-1.0: Test roles/compute.imageUser IAM.
     [FAIL]  Control Source Code Error ./controls/example.rb:10
     undefined method `google_project_iam_binding' for #<Inspec::Rule:0x000001d7d0965cb8>
     Did you mean?  google_project_iam_bindings
                    google_project_iam_policy


Profile:   Google Cloud Platform Resource Pack (inspec-gcp)
Version:   1.10.29
Target:    gcp://764086051811-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com
Target ID: 8f58cc11-1c37-5ad5-b7ce-950b9375e19f

     No tests executed.

Profile Summary: 0 successful controls, 1 control failure, 0 controls skipped
Test Summary: 0 successful, 1 failure, 0 skipped

Downgrading to v1.8.0 fixes the problem.

C:\temp\inspec-test\my-profile>inspec exec . -t gcp:// --input-file inputs.yml

Profile:   GCP InSpec Profile (my-profile)
Version:   0.1.0
Target:    gcp://764086051811-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com
Target ID: 8f58cc11-1c37-5ad5-b7ce-950b9375e19f

  [PASS]  gcp-test-iam-1.0: Test roles/compute.imageUser IAM.
     [PASS]  Project IamBinding some-gcp-project Role: roles/compute.imageUser is expected to exist
     [PASS]  Project IamBinding some-gcp-project Role: roles/compute.imageUser members is expected to include "serviceAccount:some-sa@some-gcp-project .iam.gserviceaccount.com"


Profile:   Google Cloud Platform Resource Pack (inspec-gcp)
Version:   1.8.0
Target:    gcp://764086051811-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com
Target ID: 8f58cc11-1c37-5ad5-b7ce-950b9375e19f

     No tests executed.

Profile Summary: 1 successful control, 0 control failures, 0 controls skipped
Test Summary: 2 successful, 0 failures, 0 skipped

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions