Родитель
770bba535e
Коммит
e73071fb87
|
@ -2,6 +2,11 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
What's changed since pre-release v0.1.0-B2012004:
|
||||
|
||||
- Bug fixes:
|
||||
- Fixed use of lower case `Tags` resource property. [#43](https://github.com/microsoft/PSRule.Rules.CAF/issues/43)
|
||||
|
||||
## v0.1.0-B2012004 (pre-release)
|
||||
|
||||
What's changed since pre-release v0.1.0-B2009009:
|
||||
|
|
|
@ -11,7 +11,7 @@ Rule 'CAF.Tag.Resource' -If { (CAF_SupportsTags) -and !(CAF_IsResourceGroup) -an
|
|||
if ($required.Length -eq 0) {
|
||||
return $Assert.Pass();
|
||||
}
|
||||
$Assert.HasField($TargetObject, 'Tags');
|
||||
$Assert.HasField($TargetObject, 'tags');
|
||||
if ($Null -ne $TargetObject.Tags) {
|
||||
$Assert.HasFields($TargetObject.Tags, $required, $Configuration.CAF_MatchTagNameCase);
|
||||
}
|
||||
|
@ -23,14 +23,17 @@ Rule 'CAF.Tag.ResourceGroup' -Type 'Microsoft.Resources/resourceGroups' -If { ($
|
|||
if ($required.Length -eq 0) {
|
||||
return $Assert.Pass();
|
||||
}
|
||||
$Assert.HasField($TargetObject, 'Tags');
|
||||
$Assert.HasField($TargetObject, 'tags');
|
||||
if ($Null -ne $TargetObject.Tags) {
|
||||
$Assert.HasFields($TargetObject.Tags, $required, $Configuration.CAF_MatchTagNameCase);
|
||||
}
|
||||
}
|
||||
|
||||
# Synopsis: Tag resources and resource groups with a valid environment.
|
||||
Rule 'CAF.Tag.Environment' -If { (CAF_SupportsTags) -and (Exists "Tags.$($Configuration.CAF_EnvironmentTag)") } {
|
||||
$Assert.HasField($TargetObject, "Tags.$($Configuration.CAF_EnvironmentTag)", $Configuration.CAF_MatchTagNameCase);
|
||||
$Assert.In($TargetObject, "Tags.$($Configuration.CAF_EnvironmentTag)", $Configuration.CAF_Environments, $Configuration.CAF_MatchTagValueCase)
|
||||
Rule 'CAF.Tag.Environment' -If { (CAF_SupportsTags) -and (Exists "tags.$($Configuration.CAF_EnvironmentTag)") } {
|
||||
$Assert.HasField($TargetObject, 'tags');
|
||||
if ($Null -ne $TargetObject.Tags) {
|
||||
$Assert.HasField($TargetObject.Tags, $Configuration.CAF_EnvironmentTag, $Configuration.CAF_MatchTagNameCase);
|
||||
$Assert.In($TargetObject.Tags, $Configuration.CAF_EnvironmentTag, $Configuration.CAF_Environments, $Configuration.CAF_MatchTagValueCase);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ Describe 'CAF.Tag' -Tag 'tag' {
|
|||
@{
|
||||
Name = 'vnet-A'
|
||||
Type = 'Microsoft.Network/virtualNetworks'
|
||||
Tags = @{
|
||||
tags = @{
|
||||
Env = 'Prod'
|
||||
}
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче