You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, I'm trying to describe secondary_ip_ranges of google_compute_subnetwork Inspec resource.
I have something similar to the following below.
control "my_subnet" do
impact 1.0
title "Ensure subnet has the correct properties"
describe google_compute_subnetwork(project: gcp_project_id, region: region, name: "my-subnet") do
it { should exist }
its("purpose") { should cmp "PRIVATE" }
its("private_ip_google_access") { should be true }
its("log_config.enable") { should be true }
its("log_config.flow_sampling") { should cmp "1" }
its("log_config.aggregation_interval") { should cmp "INTERVAL_15_MIN" }
its("log_config.metadata") { should include "INCLUDE_ALL_METADATA" }
end
But I'm not sure how to describe secondary_ip_ranges in my control block.
I've tried iteration as below (and other ways) to no avail.
%w{google_compute_subnetwork(project: gcp_project_id, region: region, name: "my-subnet", beta: true).secondary_ip_ranges}.each do |e|
describe e do
its("range_name") { should include "kube-services" }
# its("e.range_name") { should cmp "kube-services" }
# it { should include "kube-services" }
# its("ip_cidr_range") { should eq 443 }
end
end
Could somebody explain my mistakes here? I keep getting undefined method 'range_name'
The text was updated successfully, but these errors were encountered:
@sandal-maker I had the same question, for me it works this way:
describe google_compute_subnetwork(
project: gcp_project_id,
region : region,
name : 'my-subnet'
).secondary_ip_ranges[0] do
its('range_name') { should eq 'pod' }
its('ip_cidr_range') { should eq '10.20.0.0/16' }
end
@sandal-maker commented on Mon Mar 08 2021
This is just question
At the moment, I'm trying to describe
secondary_ip_ranges
ofgoogle_compute_subnetwork
Inspec resource.I have something similar to the following below.
But I'm not sure how to describe
secondary_ip_ranges
in mycontrol
block.According to the documentation, its an array.
I've tried iteration as below (and other ways) to no avail.
Could somebody explain my mistakes here? I keep getting
undefined method 'range_name'
The text was updated successfully, but these errors were encountered: