google_storage_buckets resource
Use the google_storage_buckets InSpec audit resource to to test a Google Cloud Bucket resource.
Examples
describe google_storage_buckets(project: 'chef-gcp-inspec') do
its('bucket_names') { should include bucket-name }
end
Test that there are no more than a specified number of storage buckets for the project
describe google_storage_buckets(project: 'chef-inspec-gcp') do
its('count') { should be <= 100}
end
Test that an expected named bucket is available
describe google_storage_buckets do
its('bucket_names'){ should include "my_expected_bucket" }
end
Test that all buckets belong to the expected project number
google_storage_buckets(project: 'chef-inspec-gcp').bucket_names.each do |bucket_name|
describe google_storage_bucket(name: bucket_name) do
it { should exist }
its('project_number'){ should eq 1122334455 }
end
end
Properties
Properties that can be accessed from the google_storage_buckets resource:
See google_storage_bucket for more detailed information.
acls: an array ofgoogle_storage_bucketaclcors: an array ofgoogle_storage_bucketcorsdefault_event_based_holds: an array ofgoogle_storage_bucketdefault_event_based_holddefault_object_acls: an array ofgoogle_storage_bucketdefault_object_aclbucket_ids: an array ofgoogle_storage_bucketidlifecycles: an array ofgoogle_storage_bucketlifecyclebucket_locations: an array ofgoogle_storage_bucketlocationloggings: an array ofgoogle_storage_bucketloggingmetagenerations: an array ofgoogle_storage_bucketmetagenerationbucket_names: an array ofgoogle_storage_bucketnameowners: an array ofgoogle_storage_bucketownerbucket_project_numbers: an array ofgoogle_storage_bucketproject_numberstorage_classes: an array ofgoogle_storage_bucketstorage_classtime_createds: an array ofgoogle_storage_buckettime_createdupdateds: an array ofgoogle_storage_bucketupdatedversionings: an array ofgoogle_storage_bucketversioningwebsites: an array ofgoogle_storage_bucketwebsitelabels: an array ofgoogle_storage_bucketlabelsencryptions: an array ofgoogle_storage_bucketencryptionretention_policies: an array ofgoogle_storage_bucketretention_policyprojects: an array ofgoogle_storage_bucketprojectpredefined_default_object_acls: an array ofgoogle_storage_bucketpredefined_default_object_acl
Filter criteria
This resource supports all of the above properties as filter criteria, which can be used
with where as a block or a method.
GCP permissions
Ensure the Google Cloud Storage is enabled for the current project.