diff --git a/README.md b/README.md index 7b81cfc4f8..373c3e0ef2 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ The following example shows basic PSRule usage. For specific use cases see [scen ### Define a rule -To define a rule use the `Rule` keyword. +To define a rule, use a `Rule` block saved to a file with the `.Rule.ps1` extension. ```powershell Rule 'NameOfRule' { @@ -45,25 +45,26 @@ Within the body of the rule provide one or more conditions. A condition is valid For example: ```powershell -# Saved to isFruit.Rule.ps1 Rule 'isFruit' { # Condition to determine if the object is fruit $TargetObject.Name -in 'Apple', 'Orange', 'Pear' } ``` -An optional result message can be added to by using the `Hint` keyword. +An optional result message can be added to by using the `Recommend` keyword. ```powershell Rule 'isFruit' { # An additional message to display in output - Hint 'Fruit is only Apple, Orange and Pear' + Recommend 'Fruit is only Apple, Orange and Pear' # Condition to determine if the object is fruit $TargetObject.Name -in 'Apple', 'Orange', 'Pear' } ``` +The rule above is saved to the [`isFruit.Rule.ps1`](docs/scenarios/fruit/isFruit.Rule.ps1) file. One or more rules can be defined within a single file. + ### Execute a rule To execute the rule use `Invoke-PSRule`. diff --git a/docs/scenarios/azure-tags/azure-tags.md b/docs/scenarios/azure-tags/azure-tags.md index 813483ed29..003bce2c52 100644 --- a/docs/scenarios/azure-tags/azure-tags.md +++ b/docs/scenarios/azure-tags/azure-tags.md @@ -244,24 +244,24 @@ Our output looked like this: ```text TargetName: storage -RuleName Outcome Message --------- ------- ------- +RuleName Outcome Recommendation +-------- ------- -------------- costCentreTag Fail Resource must have costCentre tag businessUnitTag Fail Resource must have businessUnit tag TargetName: web-app -RuleName Outcome Message --------- ------- ------- +RuleName Outcome Recommendation +-------- ------- -------------- environmentTag Fail Resource must have environment tag costCentreTag Fail Resource must have costCentre tag TargetName: web-app/staging -RuleName Outcome Message --------- ------- ------- +RuleName Outcome Recommendation +-------- ------- -------------- environmentTag Fail Resource must have environment tag costCentreTag Fail Resource must have costCentre tag ``` diff --git a/docs/scenarios/fruit/isFruit.Rule.ps1 b/docs/scenarios/fruit/isFruit.Rule.ps1 index d4ad0b9bc7..8ded8e7a4f 100644 --- a/docs/scenarios/fruit/isFruit.Rule.ps1 +++ b/docs/scenarios/fruit/isFruit.Rule.ps1 @@ -1,7 +1,8 @@ + # Synopsis: An example rule Rule 'isFruit' { # An additional message to display in output - Hint 'Fruit is only Apple, Orange and Pear' + Recommend 'Fruit is only Apple, Orange and Pear' # Condition to determine if the object is fruit $TargetObject.Name -in 'Apple', 'Orange', 'Pear' diff --git a/docs/scenarios/kubernetes-resources/kubernetes-resources.md b/docs/scenarios/kubernetes-resources/kubernetes-resources.md index b931c6bb2f..4d98272209 100644 --- a/docs/scenarios/kubernetes-resources/kubernetes-resources.md +++ b/docs/scenarios/kubernetes-resources/kubernetes-resources.md @@ -235,8 +235,8 @@ The resulting output is: ```text TargetName: app1-cache -RuleName Outcome Message --------- ------- ------- +RuleName Outcome Recommendation +-------- ------- -------------- deployment.HasMinimumReplicas Fail Deployments use a minimum of 2 replicas deployment.NotLatestImage Fail Deployments use specific tags deployment.ResourcesSet Fail Resource requirements are set for each container @@ -244,8 +244,8 @@ deployment.ResourcesSet Fail Resource requirements are set for TargetName: app1-cache-service -RuleName Outcome Message --------- ------- ------- +RuleName Outcome Recommendation +-------- ------- -------------- metadata.Name Fail Must have the app.kubernetes.io/name label metadata.Version Fail Must have the app.kubernetes.io/version label metadata.Component Fail Must have the app.kubernetes.io/component label @@ -253,8 +253,8 @@ metadata.Component Fail Must have the app.kubernetes.io/c TargetName: app1-ui -RuleName Outcome Message --------- ------- ------- +RuleName Outcome Recommendation +-------- ------- -------------- metadata.Version Fail Must have the app.kubernetes.io/version label ``` diff --git a/docs/scenarios/validation-pipeline/validation-pipeline.md b/docs/scenarios/validation-pipeline/validation-pipeline.md index 707b6e72b8..32d39ba333 100644 --- a/docs/scenarios/validation-pipeline/validation-pipeline.md +++ b/docs/scenarios/validation-pipeline/validation-pipeline.md @@ -38,8 +38,8 @@ if ($Null -eq (Get-PackageProvider -Name NuGet -ErrorAction Ignore)) { $Null = Install-PackageProvider -Name NuGet -Scope CurrentUser -Force; } -if ($Null -eq (Get-InstalledModule -Name PSRule -MinimumVersion '0.5.0' -ErrorAction Ignore)) { - $Null = Install-Module -Name PSRule -Scope CurrentUser -MinimumVersion '0.5.0' -Force; +if ($Null -eq (Get-InstalledModule -Name PSRule -MinimumVersion '0.6.0' -ErrorAction Ignore)) { + $Null = Install-Module -Name PSRule -Scope CurrentUser -MinimumVersion '0.6.0' -Force; } ``` @@ -57,8 +57,8 @@ task InstallNuGet { # Synopsis: Install PSRule task InstallPSRule InstallNuGet, { - if ($Null -eq (Get-InstalledModule -Name PSRule -MinimumVersion '0.5.0' -ErrorAction Ignore)) { - $Null = Install-Module -Name PSRule -Scope CurrentUser -MinimumVersion '0.5.0' -Force; + if ($Null -eq (Get-InstalledModule -Name PSRule -MinimumVersion '0.6.0' -ErrorAction Ignore)) { + $Null = Install-Module -Name PSRule -Scope CurrentUser -MinimumVersion '0.6.0' -Force; } } ```