diff --git a/mmv1/products/secretmanager/inspec.yaml b/mmv1/products/secretmanager/inspec.yaml new file mode 100644 index 000000000..28cb365e9 --- /dev/null +++ b/mmv1/products/secretmanager/inspec.yaml @@ -0,0 +1,15 @@ +# Copyright 2017 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- !ruby/object:Provider::Inspec::Config +overrides: !ruby/object:Overrides::ResourceOverrides diff --git a/mmv1/templates/inspec/examples/google_secret_manager_secret/google_secret_manager_secret.erb b/mmv1/templates/inspec/examples/google_secret_manager_secret/google_secret_manager_secret.erb new file mode 100644 index 000000000..a8be7f594 --- /dev/null +++ b/mmv1/templates/inspec/examples/google_secret_manager_secret/google_secret_manager_secret.erb @@ -0,0 +1,10 @@ +<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%> +<% project_secret = grab_attributes(pwd)['project_secret'] -%> +describe google_secret_manager_secret(name: <%= doc_generation ? "' #{project_secret['name']}'":"project_secret['name']" -%>) do + it { should exist } + +end + +describe google_secret_manager_secret(name: "does_not_exit") do + it { should_not exist } +end diff --git a/mmv1/templates/inspec/examples/google_secret_manager_secret/google_secret_manager_secret_attributes.erb b/mmv1/templates/inspec/examples/google_secret_manager_secret/google_secret_manager_secret_attributes.erb new file mode 100644 index 000000000..afaf93f91 --- /dev/null +++ b/mmv1/templates/inspec/examples/google_secret_manager_secret/google_secret_manager_secret_attributes.erb @@ -0,0 +1,3 @@ +gcp_project_id = input(:gcp_project_id, value: '<%= external_attribute(pwd, 'gcp_project_id') -%>', description: 'The GCP project identifier.') + + project_secret = input('project_secret', value: <%= JSON.pretty_generate(grab_attributes(pwd)['project_secret']) -%>, description: 'project_secret description') \ No newline at end of file diff --git a/mmv1/templates/inspec/examples/google_secret_manager_secret/google_secret_manager_secrets.erb b/mmv1/templates/inspec/examples/google_secret_manager_secret/google_secret_manager_secrets.erb new file mode 100644 index 000000000..25960351d --- /dev/null +++ b/mmv1/templates/inspec/examples/google_secret_manager_secret/google_secret_manager_secrets.erb @@ -0,0 +1,5 @@ +<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%> + <% project_secret = grab_attributes(pwd)['project_secret'] -%> + describe google_secret_manager_secrets(parent: <%= doc_generation ? "' #{project_secret['parent']}'":"project_secret['parent']" -%>) do + it { should exist } + end diff --git a/mmv1/templates/inspec/examples/google_secret_manager_secret_version/google_secret_manager_secret_version.erb b/mmv1/templates/inspec/examples/google_secret_manager_secret_version/google_secret_manager_secret_version.erb new file mode 100644 index 000000000..a8be7f594 --- /dev/null +++ b/mmv1/templates/inspec/examples/google_secret_manager_secret_version/google_secret_manager_secret_version.erb @@ -0,0 +1,10 @@ +<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%> +<% project_secret = grab_attributes(pwd)['project_secret'] -%> +describe google_secret_manager_secret(name: <%= doc_generation ? "' #{project_secret['name']}'":"project_secret['name']" -%>) do + it { should exist } + +end + +describe google_secret_manager_secret(name: "does_not_exit") do + it { should_not exist } +end diff --git a/mmv1/templates/inspec/examples/google_secret_manager_secret_version/google_secret_manager_secret_version_attributes.erb b/mmv1/templates/inspec/examples/google_secret_manager_secret_version/google_secret_manager_secret_version_attributes.erb new file mode 100644 index 000000000..afaf93f91 --- /dev/null +++ b/mmv1/templates/inspec/examples/google_secret_manager_secret_version/google_secret_manager_secret_version_attributes.erb @@ -0,0 +1,3 @@ +gcp_project_id = input(:gcp_project_id, value: '<%= external_attribute(pwd, 'gcp_project_id') -%>', description: 'The GCP project identifier.') + + project_secret = input('project_secret', value: <%= JSON.pretty_generate(grab_attributes(pwd)['project_secret']) -%>, description: 'project_secret description') \ No newline at end of file diff --git a/mmv1/templates/inspec/examples/google_secret_manager_secret_version/google_secret_manager_secret_versions.erb b/mmv1/templates/inspec/examples/google_secret_manager_secret_version/google_secret_manager_secret_versions.erb new file mode 100644 index 000000000..25960351d --- /dev/null +++ b/mmv1/templates/inspec/examples/google_secret_manager_secret_version/google_secret_manager_secret_versions.erb @@ -0,0 +1,5 @@ +<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%> + <% project_secret = grab_attributes(pwd)['project_secret'] -%> + describe google_secret_manager_secrets(parent: <%= doc_generation ? "' #{project_secret['parent']}'":"project_secret['parent']" -%>) do + it { should exist } + end diff --git a/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml b/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml index 5c4d5d03e..e9591f1e3 100644 --- a/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml +++ b/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml @@ -943,5 +943,9 @@ project_location_environment: create_time : "value_createtime" update_time : "value_updatetime" + +project_secret: + name : "value_name" + service_connection: parent : "value_parent" \ No newline at end of file