A google_sql_database_instances is used to test a Google DatabaseInstance resource
describe google_sql_database_instances(project: 'chef-gcp-inspec') do
its('instance_states') { should include 'RUNNABLE' }
its('instance_names') { should include 'my-database' }
end
describe google_sql_database_instances(project: 'chef-inspec-gcp') do
its('count') { should be <= 100}
end
describe google_sql_database_instances(project: 'chef-inspec-gcp') do
its('instance_zones') { should include "us-east1-b" }
end
describe google_sql_database_instances(project: 'chef-inspec-gcp') do
its('instance_regions') { should include "us-east1" }
end
describe google_sql_database_instances(project: 'chef-inspec-gcp') do
its('instance_states') { should include "RUNNABLE" }
end
google_sql_database_instances(project: 'chef-inspec-gcp').where(instance_name: /mysqldb/).instance_names.each do |instance_name|
describe google_sql_database_instance(project: 'chef-inspec-gcp', database: instance_name) do
it { should exist }
its('database_version') { should eq "MYSQL_5_7" }
end
end
Properties that can be accessed from the google_sql_database_instances resource:
See the google_sql_database_instance resource for more information.
backend_typesgoogle_sql_database_instance backend_typeconnection_namesgoogle_sql_database_instance connection_nameinstance_versionsgoogle_sql_database_instance database_versionfailover_replicasgoogle_sql_database_instance failover_replicainstance_typesgoogle_sql_database_instance instance_typeip_addressesgoogle_sql_database_instance ip_addressesipv6_addressesgoogle_sql_database_instance ipv6_addressmaster_instance_namesgoogle_sql_database_instance master_instance_namemax_disk_sizesgoogle_sql_database_instance max_disk_sizeinstance_namesgoogle_sql_database_instance nameinstance_regionsgoogle_sql_database_instance regionreplica_configurationsgoogle_sql_database_instance replica_configurationsettingsgoogle_sql_database_instance settingsinstance_zonesgoogle_sql_database_instance gce_zoneinstance_statesgoogle_sql_database_instance stateThis 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_database_instances/