Closed neil-yechenwei closed 5 years ago
This issue was solved in PR #40.
We provide the features of
property_check_includes
field to specify the properties users want to include from all the properties listed in property filed.property_check_excludes
field to specify the properties users want to exclude.property_check_includes
rather than property_check_excludes
.The customization rules in the basic.yaml or complete.yaml are
prop*
to represent all the sub-properties inside the prop
.Here is an example. And this results in checking only all the representations with prefix custom_rules.1
in test file.
--- !ruby/object:Provider::Azure::Example
resource: azurerm_web_application_firewall_policy
prerequisites:
- !ruby/object:Provider::Azure::ExampleReference
product: resourcegroup
example: basic
properties:
name: "<%= get_resource_name('ApplicationGatewayWebApplicationFirewallPolicies', 'wafpolicy') -%>"
resource_group_name: ${azurerm_resource_group.<%= resource_id_hint -%>.name}
location: ${azurerm_resource_group.<%= resource_id_hint -%>.location}
custom_rules:
- name: Rule1
priority: 1
rule_type: MatchRule
match_conditions:
- match_variables:
- variable_name: RemoteAddr
operator: IPMatch
negation_conditon: false
match_values: [192.168.1.0/24, 10.0.0.0/24]
action: Block
- name: Rule2
priority: 2
rule_type: MatchRule
match_conditions:
- match_variables:
- variable_name: RemoteAddr
operator: IPMatch
negation_conditon: false
match_values: [192.168.1.0/24]
- match_variables:
- variable_name: RequestHeaders
selector: UserAgent
operator: Contains
negation_conditon: false
match_values: [Windows]
action: Block
property_check_excludes:
- custom_rules.#
- custom_rules.0.*
Basic.yml: properties: virtual_wan: id:"${azurerm_virtual_wan.<%=resource_id_hint-%>.id}"
.go file: resource.TestCheckResourceAttr(dataSourceName, "virtual_wan.0.id", "${azurerm_virtual_wan.<%= resource_id_hint -%>.id}"),