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

undefined method google_project_iam_binding #420

Closed
levid0s opened this issue Jun 16, 2022 · 2 comments · Fixed by #423
Closed

undefined method google_project_iam_binding #420

levid0s opened this issue Jun 16, 2022 · 2 comments · Fixed by #423
Assignees

Comments

@levid0s
Copy link

levid0s commented Jun 16, 2022

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:[email protected]' }
  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
@rbclark
Copy link
Contributor

rbclark commented Jul 1, 2022

It seems this file was deleted as part of 1dded28 however it is not clear why it was removed.

@sa-progress sa-progress self-assigned this Jul 4, 2022
@sa-progress sa-progress linked a pull request Jul 4, 2022 that will close this issue
@sa-progress
Copy link
Contributor

@rbclark fix has been provided.It happened due to one of the wrong commit.
I have reverted the commit It should be working fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants