google_kms_crypto_keys resource
Use the google_kms_crypto_keys InSpec audit resource to to test a Google Cloud CryptoKey resource.
Examples
describe google_kms_crypto_keys(project: 'chef-gcp-inspec', location: 'europe-west2', key_ring_name: 'kms-key-ring') do
its('count') { should be >= 1 }
its('crypto_key_names') { should include 'kms-key' }
end
Test that there are no more than a specified number of keys in the key ring
describe google_kms_crypto_keys(project: 'chef-inspec-gcp', location: 'us-east1', key_ring_name: 'key-ring') do
its('count') { should be <= 100}
end
Test that an expected key name is present in the key ring
describe google_kms_crypto_keys(project: 'chef-inspec-gcp', location: 'us-east1', key_ring_name: 'key-ring') do
its('crypto_key_names') { should include "my-crypto-key-name" }
end
Properties
Properties that can be accessed from the google_kms_crypto_keys resource:
See google_kms_crypto_key for more detailed information.
crypto_key_names: an array ofgoogle_kms_crypto_keycrypto_key_namecreate_times: an array ofgoogle_kms_crypto_keycreate_timelabels: an array ofgoogle_kms_crypto_keylabelspurposes: an array ofgoogle_kms_crypto_keypurposerotation_periods: an array ofgoogle_kms_crypto_keyrotation_periodversion_templates: an array ofgoogle_kms_crypto_keyversion_templatenext_rotation_times: an array ofgoogle_kms_crypto_keynext_rotation_timekey_rings: an array ofgoogle_kms_crypto_keykey_ringskip_initial_version_creations: an array ofgoogle_kms_crypto_keyskip_initial_version_creation
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 Cloud Key Management Service (KMS) API is enabled for the current project.