A google_compute_security_policy is used to test a Google SecurityPolicy resource
This resource has beta fields available. To retrieve these fields, include beta: true in the constructor for the resource
describe google_compute_security_policy(project: 'chef-gcp-inspec', name: 'sec-policy') do
it { should exist }
its('rules.size') { should cmp 2 }
its('rules.first.priority') { should cmp '1000' }
its('rules.first.match.config.src_ip_ranges.first') { should cmp '9.9.9.0/24' }
end
describe google_compute_security_policy(project: 'chef-gcp-inspec', name: 'nonexistent') do
it { should_not exist }
end
Properties that can be accessed from the google_compute_security_policy resource:
nameidrulesdescriptionpriorityactionpreviewmatchdescription : A description of the rule.
expr : User defined CEVAL expression. A CEVAL expression is used to specify match criteria such as origin.ip, source.region_code and contents in the request header.
`expression`
: Textual representation of an expression in Common Expression Language syntax.
`title`
: Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
`description`
: Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
`location`
: Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
versioned_expr : Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding srcIpRange field in config.
config : The configuration options available when specifying versionedExpr. This field must be specified if versionedExpr is specified and cannot be specified if versionedExpr is not specified.
`src_ip_ranges`
: CIDR IP address range.
Ensure the Compute Engine API is enabled for the current project.
© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/inspec/resources/google_compute_security_policy/