forked from microsoft/PSRule
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Publish v2 docs #68 Improve documentation on features and how to use them. * Fix file headers * Update docs path
- Loading branch information
1 parent
7f5a182
commit 4f2f5c6
Showing
34 changed files
with
1,044 additions
and
511 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
author: BernieWhite | ||
--- | ||
|
||
# What is PSRule? | ||
|
||
PSRule is a rules engine geared towards testing Infrastructure as Code (IaC). | ||
Rules you write or import perform static analysis on IaC artifacts such as: | ||
templates, manifests, pipelines, and workflows. | ||
|
||
## Why use PSRule? | ||
|
||
PSRule aims to provide a rich experience for building and running static analysis tests on IaC. | ||
While this has some similarities to traditional testing frameworks it extends on the following: | ||
|
||
- **Reuse and share** — existing pre-built rules, configure, or write your own. | ||
- **Incremental adoption** — with baselines allows you to keep moving forward. | ||
- **Handle exceptions** — and keep exceptions auditable in git history. | ||
- **Documentation** — provides recommendations and examples instead of just pass or fail. | ||
|
||
*[IaC]: Infrastructure as Code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Additional modules | ||
|
||
## Pre-built rules | ||
|
||
The following modules contain pre-built rules that can be plugged into your pipeline. | ||
|
||
Module | Description | Version / downloads | ||
------ | ----------- | ------------------- | ||
[PSRule.Rules.Azure] | A suite of rules to validate Azure resources and infrastructure as code (IaC) using PSRule. | [![rules-azure-version-badge]][rules-azure-version-module] [![rules-azure-downloads-badge]][rules-azure-version-module] | ||
[PSRule.Rules.Kubernetes] | A suite of rules to validate Kubernetes resources using PSRule. | [![rules-kubernetes-version-badge]][rules-kubernetes-version-module] [![rules-kubernetes-downloads-badge]][rules-kubernetes-version-module] | ||
[PSRule.Rules.CAF] | A suite of rules to validate Azure resources against the Cloud Adoption Framework (CAF) using PSRule. | [![rules-caf-version-badge]][rules-caf-version-module] [![rules-caf-downloads-badge]][rules-caf-version-module] | ||
[PSRule.Rules.GitHub] | A suite of rules to validate GitHub repositories using PSRule. | [![rules-github-version-badge]][rules-github-version-module] [![rules-github-downloads-badge]][rules-github-version-module] | ||
[PSRule.Rules.MSFT.OSS] | A suite of rules to validate repositories against Microsoft Open Source Software (OSS) requirements. | [![rules-msft-oss-version-badge]][rules-msft-oss-version-module] [![rules-msft-oss-downloads-badge]][rules-msft-oss-version-module] | ||
|
||
[rules-azure-version-badge]: https://img.shields.io/powershellgallery/v/PSRule.Rules.Azure.svg?label=PowerShell%20Gallery&color=brightgreen | ||
[rules-azure-downloads-badge]: https://img.shields.io/powershellgallery/dt/PSRule.Rules.Azure.svg?color=brightgreen | ||
[rules-azure-version-module]: https://www.powershellgallery.com/packages/PSRule.Rules.Azure | ||
[rules-kubernetes-version-badge]: https://img.shields.io/powershellgallery/v/PSRule.Rules.Kubernetes.svg?label=PowerShell%20Gallery&color=brightgreen | ||
[rules-kubernetes-downloads-badge]: https://img.shields.io/powershellgallery/dt/PSRule.Rules.Kubernetes.svg?color=brightgreen | ||
[rules-kubernetes-version-module]: https://www.powershellgallery.com/packages/PSRule.Rules.Kubernetes | ||
[rules-caf-version-badge]: https://img.shields.io/powershellgallery/v/PSRule.Rules.CAF.svg?label=PowerShell%20Gallery&color=brightgreen | ||
[rules-caf-downloads-badge]: https://img.shields.io/powershellgallery/dt/PSRule.Rules.CAF.svg?color=brightgreen | ||
[rules-caf-version-module]: https://www.powershellgallery.com/packages/PSRule.Rules.CAF | ||
[rules-github-version-badge]: https://img.shields.io/powershellgallery/v/PSRule.Rules.GitHub.svg?label=PowerShell%20Gallery&color=brightgreen | ||
[rules-github-downloads-badge]: https://img.shields.io/powershellgallery/dt/PSRule.Rules.GitHub.svg?color=brightgreen | ||
[rules-github-version-module]: https://www.powershellgallery.com/packages/PSRule.Rules.GitHub | ||
[rules-msft-oss-version-badge]: https://img.shields.io/powershellgallery/v/PSRule.Rules.MSFT.OSS.svg?label=PowerShell%20Gallery&color=brightgreen | ||
[rules-msft-oss-downloads-badge]: https://img.shields.io/powershellgallery/dt/PSRule.Rules.MSFT.OSS.svg?color=brightgreen | ||
[rules-msft-oss-version-module]: https://www.powershellgallery.com/packages/PSRule.Rules.MSFT.OSS | ||
[PSRule.Rules.Azure]: https://aka.ms/ps-rule-azure | ||
[PSRule.Rules.Kubernetes]: https://github.com/microsoft/PSRule.Rules.Kubernetes | ||
[PSRule.Rules.CAF]: https://github.com/microsoft/PSRule.Rules.CAF | ||
[PSRule.Rules.GitHub]: https://github.com/microsoft/PSRule.Rules.GitHub | ||
[PSRule.Rules.MSFT.OSS]: https://github.com/microsoft/PSRule.Rules.MSFT.OSS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
author: BernieWhite | ||
--- | ||
|
||
# Storing and naming rules | ||
|
||
Rules are stored in one or more files and each file can contain one or many rules. | ||
Additionally, rules can be grouped into a module and distributed. | ||
|
||
!!! Abstract | ||
This topic covers recommendations for naming and storing rules. | ||
|
||
## Using a standard file path | ||
|
||
Rules can be standalone or packaged within a module. | ||
Standalone rules are ideal for a single project such as an Infrastructure as Code (IaC) repository. | ||
To reuse rules across multiple projects consider packaging these as a module. | ||
|
||
The instructions for packaging rules in a module can be found here: | ||
|
||
- [Packaging rules in a module](packaging-rules.md) | ||
|
||
To store standalone rules we recommend that you: | ||
|
||
- **Use .ps-rule/** — Create a sub-directory called `.ps-rule` in the root of your repository. | ||
Use all lower-case in the sub-directory name. | ||
Put any custom rules within this sub-directory. | ||
- **Use files ending with .Rule.\*** — PSRule uses a file naming convention to discover rules. | ||
Use one of the following depending on the file format you are using: | ||
- YAML - `.Rule.yaml`. | ||
- JSON - `.Rule.jsonc` or `.Rule.json`. | ||
- PowerShell - `.Rule.ps1`. | ||
|
||
!!! Note | ||
Build pipelines are often case-sensitive or run on Linux-based systems. | ||
Using the casing rule above reduces confusion latter when you configure continuous integration (CI). | ||
|
||
## Naming rules | ||
|
||
When running PSRule, rule names must be unique. | ||
For example, [PSRule for Azure][1] uses the name prefix of `Azure.` for rules included in the module. | ||
|
||
!!! Example | ||
The following names are examples of rules included within PSRule for Azure: | ||
|
||
- `Azure.AKS.Version` | ||
- `Azure.AKS.AuthorizedIPs` | ||
- `Azure.SQL.MinTLS` | ||
|
||
When naming custom rules we recommend that you: | ||
|
||
- **Use a standard prefix** — You can use the `Local.` or `Org.` prefix for standalone rules. | ||
- Alternatively choose a short prefix that identifies your organization. | ||
- **Use dotted notation** — Use dots to separate rule name. | ||
- **Use a maximum length of 35 characters** — The default view of `Invoke-PSRule` truncates longer names. | ||
PSRule supports longer rule names however if `Invoke-PSRule` is called directly consider using `Format-List`. | ||
|
||
[1]: https://aka.ms/ps-rule-azure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.