Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Generating Inspec Attributes + TF tests from single source #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/resources/google_compute_ssl_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ end
describe google_compute_ssl_policy(project: 'chef-gcp-inspec', name: 'nonexistent') do
it { should_not exist }
end

```

## Properties
Expand Down
5 changes: 2 additions & 3 deletions test/integration/build/gcp-mm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@ resource "google_compute_ssl_policy" "custom-ssl-policy" {
name = "${var.ssl_policy["name"]}"
min_tls_version = "${var.ssl_policy["min_tls_version"]}"
profile = "${var.ssl_policy["profile"]}"
custom_features = ["${var.ssl_policy["custom_feature"]}", "${var.ssl_policy["custom_feature2"]}"]
custom_features = ["${var.ssl_policy["custom_features1"]}","${var.ssl_policy["custom_features2"]}"]
project = "${var.gcp_project_id}"
}

resource "google_pubsub_topic" "topic" {
project = "${var.gcp_project_id}"
name = "${var.topic["name"]}"
Expand Down Expand Up @@ -514,4 +513,4 @@ resource "google_container_node_pool" "inspec-gcp-regional-node-pool" {
region = "${var.gcp_location}"
cluster = "${google_container_cluster.gcp-inspec-regional-cluster.name}"
node_count = "${var.regional_node_pool["node_count"]}"
}
}
13 changes: 7 additions & 6 deletions test/integration/configuration/mm-attributes.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

ssl_policy:
name: 'inspec-gcp-ssl-policy'
min_tls_version: 'TLS_1_2'
profile: 'CUSTOM'
custom_feature: 'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384'
custom_feature2: 'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384'
name: inspec-gcp-ssl-policy
min_tls_version: TLS_1_2
profile: CUSTOM
custom_features1: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
custom_features2: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

topic:
name: 'inspec-gcp-topic'
Expand Down Expand Up @@ -208,4 +209,4 @@ regional_node_pool:
name: inspec-gcp-regional-node-pool
cluster_name: inspec-gcp-regional-node-pool-cluster
node_count: 1
initial_node_count: 1
initial_node_count: 1
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"name": "inspec-gcp-ssl-policy",
"min_tls_version": "TLS_1_2",
"profile": "CUSTOM",
"custom_feature": "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
"custom_feature2": "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
"custom_features1": "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
"custom_features2": "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
})
control 'google_compute_ssl_policies-1.0' do
impact 1.0
Expand Down
8 changes: 4 additions & 4 deletions test/integration/verify/controls/google_compute_ssl_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"name": "inspec-gcp-ssl-policy",
"min_tls_version": "TLS_1_2",
"profile": "CUSTOM",
"custom_feature": "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
"custom_feature2": "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
"custom_features1": "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
"custom_features2": "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
})
control 'google_compute_ssl_policy-1.0' do
impact 1.0
Expand All @@ -30,8 +30,8 @@
it { should exist }
its('min_tls_version') { should eq ssl_policy['min_tls_version'] }
its('profile') { should eq ssl_policy['profile'] }
its('custom_features') { should include ssl_policy['custom_feature'] }
its('custom_features') { should include ssl_policy['custom_feature2'] }
its('custom_features') { should include ssl_policy['custom_features1'] }
its('custom_features') { should include ssl_policy['custom_features2'] }
end

describe google_compute_ssl_policy(project: gcp_project_id, name: 'nonexistent') do
Expand Down