From 038f15323ba8166798e945daddc5c8439691f560 Mon Sep 17 00:00:00 2001 From: Stuart Paterson Date: Fri, 23 Aug 2019 15:58:38 +0100 Subject: [PATCH 1/2] Fix for regional compute disk creation and testing. Signed-off-by: Stuart Paterson --- test/integration/build/gcp.tf | 10 +++++++++- .../verify/controls/google_compute_regional_disk.rb | 10 +--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/integration/build/gcp.tf b/test/integration/build/gcp.tf index 60a3cf954..10e2b125c 100644 --- a/test/integration/build/gcp.tf +++ b/test/integration/build/gcp.tf @@ -869,4 +869,12 @@ resource "google_compute_firewall" "inspec-gcp-tag-test-fw" { source_ranges = ["0.0.0.0/0"] target_tags = ["allow-gcp-inspec-app-mig2","allow-gcp-inspec-app-mig3"] source_tags = ["allow-gcp-inspec-app-mig1"] -} \ No newline at end of file +} + +resource "google_compute_region_disk" "regiondisk" { + project = "${var.gcp_project_id}" + name = "${var.gcp_compute_disk_name}-regional" + type = "#{var.gcp_compute_disk_type}" + region = "${var.gcp_location}" + replica_zones = ["${var.gcp_kube_cluster_zone}", "${var.gcp_kube_cluster_zone_extra1}"] +} diff --git a/test/integration/verify/controls/google_compute_regional_disk.rb b/test/integration/verify/controls/google_compute_regional_disk.rb index 5f72a3566..082626b19 100644 --- a/test/integration/verify/controls/google_compute_regional_disk.rb +++ b/test/integration/verify/controls/google_compute_regional_disk.rb @@ -8,19 +8,11 @@ impact 1.0 title 'google_compute_regional_disk resource test' - describe google_compute_regional_disk(project: gcp_project_id, name: gcp_compute_disk_name, region: gcp_region) do + describe google_compute_regional_disk(project: gcp_project_id, name: "#{gcp_compute_disk_name}-regional", region: gcp_region) do it { should exist } its('type') { should match gcp_compute_disk_type } end - describe.one do - google_compute_regional_disk(project: gcp_project_id, name: gcp_compute_disk_name, region: gcp_region).labels.each_pair do |key, value| - describe key do - it { should cmp "environment" } - end - end - end - describe google_compute_regional_disk(project: gcp_project_id, name: 'nonexistent', region: gcp_region) do it { should_not exist } end From b97619478993f41d83681a617039136e8439375d Mon Sep 17 00:00:00 2001 From: Stuart Paterson Date: Fri, 23 Aug 2019 16:14:38 +0100 Subject: [PATCH 2/2] Fix disk type name. Signed-off-by: Stuart Paterson --- test/integration/build/gcp.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/build/gcp.tf b/test/integration/build/gcp.tf index 10e2b125c..c7bffae92 100644 --- a/test/integration/build/gcp.tf +++ b/test/integration/build/gcp.tf @@ -874,7 +874,7 @@ resource "google_compute_firewall" "inspec-gcp-tag-test-fw" { resource "google_compute_region_disk" "regiondisk" { project = "${var.gcp_project_id}" name = "${var.gcp_compute_disk_name}-regional" - type = "#{var.gcp_compute_disk_type}" + type = "${var.gcp_compute_disk_type}" region = "${var.gcp_location}" replica_zones = ["${var.gcp_kube_cluster_zone}", "${var.gcp_kube_cluster_zone_extra1}"] }