A google_sql_users is used to test a Google User resource
describe google_sql_users(project: 'chef-gcp-inspec', database: 'my-database') do
its('user_names') { should include 'user-name' }
end
describe google_sql_users(project: 'chef-inspec-gcp', database: 'database-instance') do
its('count') { should be <= 100}
end
describe google_sql_users(project: 'chef-inspec-gcp') do
its('user_names') { should include "us-east1-b" }
end
describe google_sql_users(project: 'chef-inspec-gcp') do
its('user_statuses') { should_not include "DOWN" }
end
google_sql_database_instances(project: 'chef-inspec-gcp').instance_names.each do |instance_name|
describe google_sql_users(project: 'chef-inspec-gcp', database: instance_name) do
it { should exist }
end
end
Properties that can be accessed from the google_sql_users resource:
See the google_sql_user resource for more information.
user_hostsgoogle_sql_user hostuser_namesgoogle_sql_user nameuser_instancesgoogle_sql_user instancepasswordsgoogle_sql_user passwordThis resource supports all of the above properties as filter criteria, which can be used with where as a block or a method.
Ensure the Cloud SQL Admin API is enabled for the current project.
© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/inspec/resources/google_sql_users/