diff --git a/mmv1/templates/inspec/examples/google_compute_machine_type/google_compute_machine_type.erb b/mmv1/templates/inspec/examples/google_compute_machine_type/google_compute_machine_type.erb new file mode 100644 index 000000000..e16773355 --- /dev/null +++ b/mmv1/templates/inspec/examples/google_compute_machine_type/google_compute_machine_type.erb @@ -0,0 +1,18 @@ +<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%> +<% machine_type = grab_attributes(pwd)['machine_type'] -%> +describe google_compute_v1_machine_type(machineType: <%= doc_generation ? "' #{machine_type['machineType']}'":"machine_type['machineType']" -%>, project: <%= gcp_project_id -%>, zone: <%= doc_generation ? "' #{machine_type['zone']}'":"machine_type['zone']" -%>) do + it { should exist } + its('kind') { should cmp <%= doc_generation ? "'#{machine_type['kind']}'" : "machine_type['kind']" -%> } + its('id') { should cmp <%= doc_generation ? "'#{machine_type['id']}'" : "machine_type['id']" -%> } + its('creation_timestamp') { should cmp <%= doc_generation ? "'#{machine_type['creation_timestamp']}'" : "machine_type['creation_timestamp']" -%> } + its('name') { should cmp <%= doc_generation ? "'#{machine_type['name']}'" : "machine_type['name']" -%> } + its('description') { should cmp <%= doc_generation ? "'#{machine_type['description']}'" : "machine_type['description']" -%> } + its('maximum_persistent_disks_size_gb') { should cmp <%= doc_generation ? "'#{machine_type['maximum_persistent_disks_size_gb']}'" : "machine_type['maximum_persistent_disks_size_gb']" -%> } + its('zone') { should cmp <%= doc_generation ? "'#{machine_type['zone']}'" : "machine_type['zone']" -%> } + its('self_link') { should cmp <%= doc_generation ? "'#{machine_type['self_link']}'" : "machine_type['self_link']" -%> } + +end + +describe google_compute_v1_machine_type(machineType: <%= doc_generation ? "' #{machine_type['machineType']}'":"machine_type['machineType']" -%>, project: <%= gcp_project_id -%>, zone: <%= doc_generation ? "' #{machine_type['zone']}'":"machine_type['zone']" -%>) do + it { should_not exist } +end \ No newline at end of file diff --git a/mmv1/templates/inspec/examples/google_compute_machine_type/google_compute_machine_type_attributes.erb b/mmv1/templates/inspec/examples/google_compute_machine_type/google_compute_machine_type_attributes.erb new file mode 100644 index 000000000..fbfc88526 --- /dev/null +++ b/mmv1/templates/inspec/examples/google_compute_machine_type/google_compute_machine_type_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.') + + machine_type = input('machine_type', value: <%= JSON.pretty_generate(grab_attributes(pwd)['machine_type']) -%>, description: 'machine_type description') \ No newline at end of file diff --git a/mmv1/templates/inspec/examples/google_compute_machine_type/google_compute_machine_types.erb b/mmv1/templates/inspec/examples/google_compute_machine_type/google_compute_machine_types.erb new file mode 100644 index 000000000..4d5fdd21b --- /dev/null +++ b/mmv1/templates/inspec/examples/google_compute_machine_type/google_compute_machine_types.erb @@ -0,0 +1,5 @@ +<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%> + <% machine_type = grab_attributes(pwd)['machine_type'] -%> + describe google_compute_v1_machine_types(project: <%= gcp_project_id -%>, zone: <%= doc_generation ? "' #{machine_type['zone']}'":"machine_type['zone']" -%>) do + it { should exist } + end \ No newline at end of file diff --git a/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml b/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml index 43ef58e55..773830d2a 100644 --- a/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml +++ b/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml @@ -973,4 +973,15 @@ project_service_account_key: valid_after_time : "value_validaftertime" valid_before_time : "value_validbeforetime" key_origin : "value_keyorigin" - key_type : "value_keytype" \ No newline at end of file + key_type : "value_keytype" +machine_type: + machine_type : "value_machinetype" + project : "value_project" + zone : "value_zone" + kind : "value_kind" + id : "value_id" + creation_timestamp : "value_creationtimestamp" + name : "value_name" + description : "value_description" + maximum_persistent_disks_size_gb : "value_maximumpersistentdiskssizegb" + self_link : "value_selflink" \ No newline at end of file