Skip to main content

google_storage_bucket_iam_bindings resource

This resource is deprecated. Please use google_storage_bucket_iam_policy instead

Use the google_storage_bucket_iam_bindings InSpec audit resource to test properties of all, or a filtered group of, GCP storage bucket IAM bindings.


A google_storage_bucket_iam_bindings resource block collects GCP storage bucket IAM bindings then tests that group.

describe google_storage_bucket_iam_bindings(bucket: 'bucket-buvsjjcndqz') do
  it { should exist }

Use this InSpec resource to enumerate roles then test in-depth using google_project_iam_binding.

google_storage_bucket_iam_bindings(bucket: 'bucket-buvsjjcndqz').iam_binding_roles.each do |iam_binding_role|
  describe google_storage_bucket_iam_binding(bucket: 'bucket-buvsjjcndqz',  role: iam_binding_role) do
    it { should exist }
    its('members') {should include '' }


The following examples show how to use this InSpec audit resource.

Test that there are no more than a specified number of IAM bindings roles available for the bucket

describe google_storage_bucket_iam_bindings(bucket: 'bucket-buvsjjcndqz') do
  its('count') { should be <= 100}

Test that an expected role is available for the bucket

describe google_storage_bucket_iam_bindings(bucket: 'bucket-buvsjjcndqz') do
  its('iam_binding_roles') { should include "roles/storage.admin" }

Test that a particular role does not exist using filtering of the plural resource

describe google_storage_bucket_iam_bindings(bucket: 'bucket-buvsjjcndqz').where(iam_binding_role: "roles/iam.securityReviewer") do
  it { should_not exist }

Filter Criteria

This resource supports the following filter criteria: iam_binding_role. This may be used with where, as a block or as a method.


  • iam_binding_roles - an array of google_storage_bucket_iam_binding role strings e.g. ["roles/storage.admin", "roles/owner"]

GCP Permissions

Ensure the Google Cloud Storage API is enabled.

Edit this page on GitHub

Thank you for your feedback!


Search Results