Skip to content
Open
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
15 changes: 13 additions & 2 deletions docs/content/contributing/terraform/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ If you get failures, you should examine them to understand how you can make your

### Creating exceptions

In some circumstances, you may need to create an exception for a policy, you can do so by creating a `.rego` file in the `exceptions` sub-directory of your example.
For example, to exclude the rule called `"configure_aks_default_node_pool_zones"`, create a file called `exceptions/exception.rego` in your example, with the following content:
As a general rule, exceptions should only be applied to module examples where you are testing valid but non-compliant configurations. Root module defaults should still comply with WAF and Security best practices. However, if you need to create an exception for a policy, you can do so by creating a `.rego` file in the `exceptions` sub-directory of your example.

For example, to exclude the Azure Proactive Resiliency Library policy rule called `"configure_aks_default_node_pool_zones"`, create a file called `exceptions/exception.rego` in your example with the following content:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The users might need to ignore rules in different packages, could we use package name like aprl.rego and avmsec.rego in the file name?


```rego
package Azure_Proactive_Resiliency_Library_v2
Expand All @@ -99,6 +100,16 @@ exception contains rules if {
}
```

To exclude security policy rules the content varies slightly. Instead of using the `Azure_Proactive_Resiliency_Library_v2` package, you will instead need to include the `avmsec` package. An example of this would use the following pattern:

```rego
package avmsec
import rego.v1
exception contains rules if {
rules = ["AVM_SEC_178"]
}
```

## TFLint

TFLint is used to check that your module is compliant with the AVM specifications.
Expand Down