title | platform |
---|---|
About the google_compute_forwarding_rule Resource |
gcp |
Use the google_compute_forwarding_rule
InSpec audit resource to test properties of a single GCP compute forwarding_rule.
A google_compute_forwarding_rule
resource block declares the tests for a single GCP forwarding_rule by project, region and name.
describe google_compute_forwarding_rule(project: 'chef-inspec-gcp', region: 'europe-west2', name: 'gcp-inspec-forwarding_rule') do
it { should exist }
its('name') { should eq 'gcp-inspec-forwarding_rule' }
its('region') { should match 'europe-west2' }
end
The following examples show how to use this InSpec audit resource.
describe google_compute_forwarding_rule(project: 'chef-inspec-gcp', region: 'europe-west2', name: 'gcp-inspec-forwarding_rule') do
it { should exist }
end
describe google_compute_forwarding_rule(project: 'chef-inspec-gcp', region: 'europe-west2', name: 'gcp-inspec-forwarding_rule') do
its('creation_timestamp_date') { should be > Time.now - 365*60*60*24*10 }
end
describe google_compute_forwarding_rule(project: 'chef-inspec-gcp', region: 'europe-west2', name: 'gcp-inspec-forwarding_rule') do
its('id') { should eq 12345567789 }
end
describe google_compute_forwarding_rule(project: 'chef-inspec-gcp', region: 'europe-west2', name: 'gcp-inspec-forwarding_rule') do
its('load_balancing_scheme') { should eq "INTERNAL" }
end
describe google_compute_forwarding_rule(project: 'chef-inspec-gcp', region: 'europe-west2', name: 'gcp-inspec-forwarding_rule') do
its('ip_address') { should eq "10.0.0.1" }
end
describe google_compute_forwarding_rule(project: 'chef-inspec-gcp', region: 'europe-west2', name: 'gcp-inspec-forwarding_rule') do
its('network') { should match "gcp_network_name" }
end
backend_service
,creation_timestamp
,description
,id
,ip_address
,ip_protocol
,ip_version
,kind
,load_balancing_scheme
,name
,network
,port_range
,ports
,region
,self_link
,subnetwork
,target
Ensure the Compute Engine API is enabled for the project where the resource is located.